ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1178. Akbardin’s Roads

dula my AC (0.046s...) [2] // Problem 1178. Akbardin’s Roads 16 Oct 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);
    }
}
esbybb Re: my AC (0.046s...) [1] // Problem 1178. Akbardin’s Roads 3 Jul 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
esbybb Re: my AC (0.046s...) // Problem 1178. Akbardin’s Roads 3 Jul 2015 02:15
perhaps it gaves AC so your code is right, tests are wrong or problem description is not completed