Please read the new rule regarding the restriction on the use of AI tools. ×

mrTux's blog

By mrTux, 12 years ago, In English

First of all I wanna notice that because I'm not an English person there may be some English problems,I fully apologize for it & I would appreciate if U could tell me.

I've gotta question about my code.when I test it on dev cpp(v 4.9.9.2) it returns the answer but the problem is not only it doesn't even run but also it doesn't even output an endl!!when you see the code below I would appreciate if you could find the bug & tell me.and I don't wanna you debug it to me I only wanna make it work on the server.(you can check my submission on this link for the history of not running the code.)

include

include

include

include

include

include

include

include

include

include

include

include

include

include

include

include

include

include <assert.h>

include

include

include

include

include <conio.h>

using namespace std;

define FOR(i, a, n) for (register int i = (a); i < (int)(n); ++i)

define Size(n) ((int)(n).size())

define ll long long

define pb push_back

define X first

define Y second

define EPS 1e-10

define mp make_pair

define MFOR(i,m,n) for(int i=m;i>n;i--)

define error(x) cerr<<endl<<x<<endl;

define st return 0;

void error2(const string &s,const int &t){ cerr<<endl<<" "<<s<<" = "<<t<<endl; }

int main(){

int n;
cin>>n;
pair <int,int> a[n];

n*=2; cout<<1; vector <pair<int,int> > pee; cout<<21; FOR(i,0,n){ cin>>a[i].X; a[i].Y=i+1; } cout<<321; sort(a,a+n); cout<<4231; cout<<endl; for (int i=0;i<n;i+=2){ if(a[i].X != a[i+1].X){ cout<<-1; st; } else{ pee.pb(mp(a[i].Y,a[i+1].Y)); } } cout<<54321; FOR(i,0,Size(pee)) cout<<pee[i].X<<" "<<pee[i].Y<<endl; #ifndef ONLINE_JUDGE cout<<endl; #endif st; }

  • Vote: I like it
  • -27
  • Vote: I do not like it

»
12 years ago, # |
  Vote: I like it +3 Vote: I do not like it

You must read data from input.txt and write date to output.txt. To do so paste this lines into your program before any I/O operations.

    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
  • »
    »
    12 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    "t" is not needed, it is non-portable and is the default behavior anyway.

  • »
    »
    12 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    thank you