Submission #3524

#TimeUsernameProblemLanguageResultExecution timeMemory
3524solveitDivide into triangle (kriii1_D)C++98
1 / 1
0 ms1688 KiB
#include <iostream> #include <string> #include <math.h> #include <sstream> #include <cstdio> #include <algorithm> #include <set> #include <vector> using namespace std; struct Pole { int idx, x, y; }; int N; Pole A[1005]; int compare(Pole p1, Pole p2) { if(p1.x < p2.x) return true; if(p1.x == p2.x && p1.y < p2.y) return true; return false; } int main() { scanf("%d",&N); for(int i = 1;i<=3 * N;i++) { int x, y; scanf("%d %d",&x,&y); A[i].idx = i; A[i].x = x; A[i].y = y; } sort(A + 1, A + 1 + 3 * N, compare); for(int i = 1;i<=3 * N;i+=3) { printf("%d %d %d\n", A[i].idx, A[i + 1].idx, A[i + 2].idx); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...