답안 #771610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
771610 2023-07-03T07:20:50 Z CyberCow 원 고르기 (APIO18_circle_selection) C++17
7 / 100
3000 ms 22848 KB
//#include <bits/stdc++.h>
#include <random>
#include <algorithm>
#include <bitset>
#include <chrono>
#include <cmath>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#define fr first
#define sc second
#define ad push_back
using namespace std;
using ll = long long;
mt19937 rnd(348502);
const int N = 200005;
vector<pair<ll, pair<ll, ll>>> v;
int color[N];
int ans[N];

void solve()
{
    int n, i, j, x, y, r;
    cin >> n;
    for ( i = 0; i < n; i++)
    {
        cin >> x >> y >> r;
        v.push_back({ r, {x, y} });
    }
    int qan = 0;
    for ( i = 0; i < n; i++)
    {
        ll ma = 0;
        for ( j = 0; j < n; j++)
        {
            if (color[j] == 0)
            {
                ma = max(v[j].first, ma);
            }
        }
        for ( j = 0; j < n; j++)
        {
            if (color[j] == 0 && v[j].first == ma)
            {
                color[j] = 1;
                ans[j] = j + 1;
                qan++;
                for (int h = 0; h < n; h++)
                {
                    if (color[h] == 0 && (v[j].second.first - v[h].second.first) * (v[j].second.first - v[h].second.first) + (v[j].second.second - v[h].second.second) * (v[j].second.second - v[h].second.second) <= (v[j].first + v[h].first) * (v[j].first + v[h].first))
                    {
                        color[h] = 1;
                        ans[h] = j + 1;
                        qan++;
                    }
                }
                break;
            }
        }
        if (qan == n)
            break;
    }
    for ( i = 0; i < n; i++)
    {
        cout << ans[i] << ' ';
    }
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 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 328 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 728 KB Output is correct
20 Correct 2 ms 788 KB Output is correct
21 Correct 2 ms 800 KB Output is correct
22 Correct 135 ms 756 KB Output is correct
23 Correct 144 ms 748 KB Output is correct
24 Correct 133 ms 768 KB Output is correct
25 Correct 133 ms 752 KB Output is correct
26 Correct 137 ms 724 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 80 ms 21708 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Execution timed out 3045 ms 6372 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 83 ms 22848 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 328 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 728 KB Output is correct
20 Correct 2 ms 788 KB Output is correct
21 Correct 2 ms 800 KB Output is correct
22 Correct 135 ms 756 KB Output is correct
23 Correct 144 ms 748 KB Output is correct
24 Correct 133 ms 768 KB Output is correct
25 Correct 133 ms 752 KB Output is correct
26 Correct 137 ms 724 KB Output is correct
27 Correct 4 ms 1172 KB Output is correct
28 Correct 4 ms 1104 KB Output is correct
29 Correct 3 ms 1112 KB Output is correct
30 Correct 627 ms 1112 KB Output is correct
31 Correct 635 ms 1108 KB Output is correct
32 Correct 626 ms 1044 KB Output is correct
33 Correct 32 ms 7284 KB Output is correct
34 Correct 31 ms 7228 KB Output is correct
35 Correct 55 ms 7028 KB Output is correct
36 Execution timed out 3086 ms 6008 KB Time limit exceeded
37 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 328 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 2 ms 728 KB Output is correct
20 Correct 2 ms 788 KB Output is correct
21 Correct 2 ms 800 KB Output is correct
22 Correct 135 ms 756 KB Output is correct
23 Correct 144 ms 748 KB Output is correct
24 Correct 133 ms 768 KB Output is correct
25 Correct 133 ms 752 KB Output is correct
26 Correct 137 ms 724 KB Output is correct
27 Runtime error 80 ms 21708 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -