답안 #932361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
932361 2024-02-23T08:48:12 Z hmm789 원 고르기 (APIO18_circle_selection) C++14
7 / 100
3000 ms 20564 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000
#define MOD 998244353

#define x second.first
#define y second.second
#define r first.first

bool cmp(pair<pair<int, int>, pair<int, int>> a, pair<pair<int, int>, pair<int, int>> b) {
    if(a.first.first != b.first.first) return a.first.first > b.first.first;
    else return a.first.second < b.first.second;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, x1, y1, r1;
    cin >> n;
    pair<pair<int, int>, pair<int, int>> a[n];
    for(int i = 0; i < n; i++) {
        cin >> x1 >> y1 >> r1;
        a[i] = {{r1, i}, {x1, y1}};
    }
    sort(a, a+n, cmp);
    int ans[n];
    memset(ans, -1, sizeof(ans));
    for(int i = 0; i < n; i++) if(ans[a[i].first.second] == -1) {
        for(int j = 0; j < n; j++) if(ans[a[j].first.second] == -1) {
            if((a[i].x-a[j].x)*(a[i].x-a[j].x) + (a[i].y-a[j].y)*(a[i].y-a[j].y) <= (a[i].r+a[j].r)*(a[i].r+a[j].r)) {
                ans[a[j].first.second] = a[i].first.second;
            }
        }
    }
    for(int i = 0; i < n; i++) cout << ans[i]+1 << " ";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 424 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 3 ms 604 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 31 ms 636 KB Output is correct
23 Correct 33 ms 624 KB Output is correct
24 Correct 29 ms 600 KB Output is correct
25 Correct 29 ms 856 KB Output is correct
26 Correct 30 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 14164 KB Output is correct
2 Correct 127 ms 20564 KB Output is correct
3 Correct 124 ms 20052 KB Output is correct
4 Correct 120 ms 20560 KB Output is correct
5 Execution timed out 3095 ms 16720 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Execution timed out 3047 ms 6740 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3032 ms 12116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 424 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 3 ms 604 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 31 ms 636 KB Output is correct
23 Correct 33 ms 624 KB Output is correct
24 Correct 29 ms 600 KB Output is correct
25 Correct 29 ms 856 KB Output is correct
26 Correct 30 ms 604 KB Output is correct
27 Correct 4 ms 860 KB Output is correct
28 Correct 6 ms 1064 KB Output is correct
29 Correct 5 ms 1116 KB Output is correct
30 Correct 122 ms 1108 KB Output is correct
31 Correct 132 ms 1104 KB Output is correct
32 Correct 149 ms 1112 KB Output is correct
33 Correct 43 ms 8220 KB Output is correct
34 Correct 43 ms 8016 KB Output is correct
35 Correct 52 ms 7764 KB Output is correct
36 Execution timed out 3032 ms 6736 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 424 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 3 ms 604 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 31 ms 636 KB Output is correct
23 Correct 33 ms 624 KB Output is correct
24 Correct 29 ms 600 KB Output is correct
25 Correct 29 ms 856 KB Output is correct
26 Correct 30 ms 604 KB Output is correct
27 Correct 121 ms 14164 KB Output is correct
28 Correct 127 ms 20564 KB Output is correct
29 Correct 124 ms 20052 KB Output is correct
30 Correct 120 ms 20560 KB Output is correct
31 Execution timed out 3095 ms 16720 KB Time limit exceeded
32 Halted 0 ms 0 KB -