답안 #407542

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
407542 2021-05-19T02:17:34 Z tengiz05 원 고르기 (APIO18_circle_selection) C++17
7 / 100
3000 ms 14788 KB
#include <bits/stdc++.h>
using i64 = long long;
inline i64 sq(int x) { return i64(x) * x; }
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n;
    std::cin >> n;
    std::vector<int> x(n), y(n), r(n);
    for (int i = 0; i < n; i++) {
        std::cin >> x[i] >> y[i] >> r[i];
    }
    std::vector<int> ans(n, -1);
    std::vector<int> ind(n);
    iota(ind.begin(), ind.end(), 0);
    sort(ind.begin(), ind.end(), [&](int i, int j) {
        if (r[i] == r[j]) return i < j;
        return r[i] > r[j];
    });
    for (auto i : ind) {
        if (~ans[i]) continue;
        for (int j = 0; j < n; j++) {
            if (~ans[j]) continue;
            i64 d1 = sq(x[i] - x[j]) + sq(y[i] - y[j]);
            i64 d2 = sq(r[i] + r[j]);
            if (d1 <= d2) {
                ans[j] = i;
            }
        }
    }
    for (auto x : ans) std::cout << x + 1 << ' ';
    std::cout << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 5 ms 588 KB Output is correct
21 Correct 4 ms 640 KB Output is correct
22 Correct 90 ms 532 KB Output is correct
23 Correct 90 ms 532 KB Output is correct
24 Correct 109 ms 460 KB Output is correct
25 Correct 89 ms 460 KB Output is correct
26 Correct 91 ms 536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 186 ms 14752 KB Output is correct
2 Correct 174 ms 14640 KB Output is correct
3 Correct 170 ms 14412 KB Output is correct
4 Correct 165 ms 14788 KB Output is correct
5 Execution timed out 3073 ms 10592 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 3061 ms 4940 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3062 ms 13764 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 5 ms 588 KB Output is correct
21 Correct 4 ms 640 KB Output is correct
22 Correct 90 ms 532 KB Output is correct
23 Correct 90 ms 532 KB Output is correct
24 Correct 109 ms 460 KB Output is correct
25 Correct 89 ms 460 KB Output is correct
26 Correct 91 ms 536 KB Output is correct
27 Correct 9 ms 844 KB Output is correct
28 Correct 7 ms 844 KB Output is correct
29 Correct 7 ms 808 KB Output is correct
30 Correct 375 ms 764 KB Output is correct
31 Correct 373 ms 716 KB Output is correct
32 Correct 373 ms 764 KB Output is correct
33 Correct 61 ms 5956 KB Output is correct
34 Correct 61 ms 5956 KB Output is correct
35 Correct 67 ms 5816 KB Output is correct
36 Execution timed out 3068 ms 4684 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 2 ms 332 KB Output is correct
18 Correct 2 ms 332 KB Output is correct
19 Correct 4 ms 588 KB Output is correct
20 Correct 5 ms 588 KB Output is correct
21 Correct 4 ms 640 KB Output is correct
22 Correct 90 ms 532 KB Output is correct
23 Correct 90 ms 532 KB Output is correct
24 Correct 109 ms 460 KB Output is correct
25 Correct 89 ms 460 KB Output is correct
26 Correct 91 ms 536 KB Output is correct
27 Correct 186 ms 14752 KB Output is correct
28 Correct 174 ms 14640 KB Output is correct
29 Correct 170 ms 14412 KB Output is correct
30 Correct 165 ms 14788 KB Output is correct
31 Execution timed out 3073 ms 10592 KB Time limit exceeded
32 Halted 0 ms 0 KB -