답안 #3524

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
3524 2013-08-31T06:22:52 Z solveit Divide into triangle (kriii1_D) C++
1 / 1
0 ms 1688 KB
#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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1688 KB Output is correct
2 Correct 0 ms 1688 KB Output is correct
3 Correct 0 ms 1688 KB Output is correct
4 Correct 0 ms 1688 KB Output is correct
5 Correct 0 ms 1688 KB Output is correct
6 Correct 0 ms 1688 KB Output is correct
7 Correct 0 ms 1688 KB Output is correct
8 Correct 0 ms 1688 KB Output is correct
9 Correct 0 ms 1688 KB Output is correct
10 Correct 0 ms 1688 KB Output is correct
11 Correct 0 ms 1688 KB Output is correct
12 Correct 0 ms 1688 KB Output is correct
13 Correct 0 ms 1688 KB Output is correct
14 Correct 0 ms 1688 KB Output is correct
15 Correct 0 ms 1688 KB Output is correct
16 Correct 0 ms 1688 KB Output is correct
17 Correct 0 ms 1688 KB Output is correct
18 Correct 0 ms 1688 KB Output is correct
19 Correct 0 ms 1688 KB Output is correct
20 Correct 0 ms 1688 KB Output is correct