|
|
вернуться в форумmy AC (0.046s...) Послано dula 16 окт 2013 21:54 #include<stdio.h> #include<deque> #include<algorithm> using namespace std; class node{ public: int x,y,num; }dum; bool func(node i,node j) { if(i.y > j.y) return true; return false; } int main() { deque<node> city; int n; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d %d",&dum.x,&dum.y); dum.num = (i+1); city.push_back(dum); } if(n == 0) {printf("0");return 0;} sort(city.begin(),city.end(),func); for(int i=0;i<n;i+=2) { printf("%d %d\n",city[i].num,city[i+1].num); } } Re: my AC (0.046s...) Послано esbybb 3 июл 2015 02:11 your code is wrong http://ideone.com/2mv3As it prints 3 4 1 2 instead of 1 3 2 4 for the test from description of the problem Re: my AC (0.046s...) Послано esbybb 3 июл 2015 02:15 perhaps it gaves AC so your code is right, tests are wrong or problem description is not completed |
|
|