답안 #742934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742934 2023-05-17T06:25:46 Z PixelCat 원 고르기 (APIO18_circle_selection) C++14
7 / 100
124 ms 27360 KB
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;

const int MAXN = 5010;

int gg[MAXN];

int dist2(pii a, pii b) {
    return (a.F - b.F) * (a.F - b.F) + (a.S - b.S) * (a.S - b.S);
}

struct Circ {
    int id, x, y, r;
};

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // =^-w-^= nya
    int n; cin >> n;
    vector<Circ> v(n);
    For(i, 0, n - 1) {
        v[i].id = i + 1;
        cin >> v[i].x >> v[i].y >> v[i].r;
    }
    sort(all(v), [&](const Circ &a, const Circ &b) {
        if(a.r != b.r) return a.r > b.r;
        return a.id < b.id;
    });
    for(auto &c:v) {
        if(gg[c.id]) continue;
        for(auto &c2:v) if(!gg[c2.id]) {
            if(dist2(pii(c.x, c.y), pii(c2.x, c2.y)) <= (c.r + c2.r) * (c.r + c2.r)) {
                gg[c2.id] = c.id;
            }
        }
    }
    For(i, 1, n) cout << gg[i] << " \n"[i == n];
    return 0;
}

/*

11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 5 ms 592 KB Output is correct
20 Correct 3 ms 596 KB Output is correct
21 Correct 4 ms 652 KB Output is correct
22 Correct 34 ms 596 KB Output is correct
23 Correct 36 ms 644 KB Output is correct
24 Correct 41 ms 716 KB Output is correct
25 Correct 36 ms 644 KB Output is correct
26 Correct 37 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 124 ms 26204 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 46 ms 9588 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 103 ms 27360 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 5 ms 592 KB Output is correct
20 Correct 3 ms 596 KB Output is correct
21 Correct 4 ms 652 KB Output is correct
22 Correct 34 ms 596 KB Output is correct
23 Correct 36 ms 644 KB Output is correct
24 Correct 41 ms 716 KB Output is correct
25 Correct 36 ms 644 KB Output is correct
26 Correct 37 ms 640 KB Output is correct
27 Runtime error 6 ms 1428 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 320 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 2 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 5 ms 592 KB Output is correct
20 Correct 3 ms 596 KB Output is correct
21 Correct 4 ms 652 KB Output is correct
22 Correct 34 ms 596 KB Output is correct
23 Correct 36 ms 644 KB Output is correct
24 Correct 41 ms 716 KB Output is correct
25 Correct 36 ms 644 KB Output is correct
26 Correct 37 ms 640 KB Output is correct
27 Runtime error 124 ms 26204 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -