Submission #3417

#TimeUsernameProblemLanguageResultExecution timeMemory
3417QwazDivide into triangle (kriii1_D)C++98
1 / 1
0 ms1096 KiB
#include <cstdio> #include <algorithm> const int MAX=310; struct pos { int x, y, num; bool operator < (const pos &t) const { if(y == t.y) return x < t.x; return y < t.y; } }; int n; pos data[MAX*3]; void input(){ scanf("%d", &n); n *= 3; int i; for(i=0; i<n; i++){ scanf("%d%d", &data[i].x, &data[i].y); data[i].num = i+1; } } void solve(){ std::sort(data, data+n); pos p, q; int i; for(i=0; i<n; i++){ if(i%3 == 0) p = data[i]; else if(i%3 == 1) q = data[i]; else printf("%d %d %d\n", p.num, q.num, data[i].num); } } int main(){ input(); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...