Submission #5714

# Submission time Handle Problem Language Result Execution time Memory
5714 2014-05-14T10:50:15 Z baneling100 Divide into triangle (kriii1_D) C++
0 / 1
0 ms 1332 KB
#include <stdio.h>
#include <algorithm>
#include <math.h>
#define inf 0x7fffffff
#define pi 3.141592653589793238

using namespace std;

typedef pair <int,int> ppair;
typedef pair <ppair,int> pppair;
pair <double,pppair> p[901];
int N;

void input(void)
{
    int i, x, y, minx=inf, miny=inf;

    scanf("%d",&N);
    for(i=1 ; i<=3*N ; i++)
    {
        scanf("%d %d",&x,&y);
        p[i]=make_pair(0,make_pair(make_pair(x,y),i));
        if(miny>y)
        {
            miny=y;
            minx=x;
        }
        else if(miny==y)
            if(minx>x)
                minx=x;
    }
    for(i=1 ; i<=N ; i++)
        p[i].first=atan2(p[i].second.first.second-miny,p[i].second.first.first-minx);
    sort(p+1,p+N+1);
}

void output(void)
{
    int i;

    for(i=1 ; i<=3*N ; i+=3)
        printf("%d %d %d\n",p[i].second.second,p[i+1].second.second,p[i+2].second.second);
}

int main(void)
{
    input();
    output();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1332 KB Output isn't correct
2 Halted 0 ms 0 KB -