답안 #969989

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969989 2024-04-26T04:08:00 Z steveonalex 원 고르기 (APIO18_circle_selection) C++17
7 / 100
3000 ms 14280 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
#define ALL(v) (v).begin(), (v).end()
#define MASK(i) (1LL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
 
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng(1);
ll rngesus(ll l, ll r){return ((ull) rng()) % (r - l + 1) + l;}
 
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
 
ll LASTBIT(ll mask){return mask & (-mask);}
ll pop_cnt(ll mask){return __builtin_popcountll(mask);}
ll ctz(ll mask){return __builtin_ctzll(mask);}
ll clz(ll mask){return __builtin_clzll(mask);}
ll logOf(ll mask){return 63 - clz(mask);}
 
template <class T1, class T2>
    bool minimize(T1 &a, T2 b){
        if (a > b){a = b; return true;}
        return false;
    }
template <class T1, class T2>
    bool maximize(T1 &a, T2 b){
        if (a < b){a = b; return true;}
        return false;
    }
template <class T>
    void printArr(T& a, string separator = " ", string finish = "\n", ostream& out = cout){
        for(auto i: a) out << i << separator;
        out << finish;
    }
template <class T>
    void remove_dup(vector<T> &a){
        sort(ALL(a));
        a.resize(unique(ALL(a)) - a.begin());
    }

const int N = 3e5 + 69;
array<int, 3> a[N];
bool visited[N];
int ans[N];

ll sqr(ll x){return x * x;}
 
int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
 
    int n; cin >> n;
    for(int i = 1; i<=n; ++i) {
        for(int j = 0; j < 3; ++j) cin >> a[i][j];
    }

    while(true){
        int ma = 0;
        for(int i = 1; i<=n; ++i) if (!visited[i])
            if (ma == 0 || a[ma][2] < a[i][2]) ma = i;
        if (ma == 0) break;
        for(int i = 1; i<=n; ++i) if (!visited[i]){
            if (sqr(a[i][0] - a[ma][0]) + sqr(a[i][1] - a[ma][1]) <= sqr(a[i][2] + a[ma][2])){
                visited[i] = 1;
                ans[i] = ma;
            }
        }
    }

    for(int i = 1; i<=n; ++i) cout << ans[i] << " "; cout << "\n";
    

    return 0;
}

Compilation message

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:74:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   74 |     for(int i = 1; i<=n; ++i) cout << ans[i] << " "; cout << "\n";
      |     ^~~
circle_selection.cpp:74:54: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   74 |     for(int i = 1; i<=n; ++i) cout << ans[i] << " "; cout << "\n";
      |                                                      ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 1 ms 2520 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 4 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2528 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 2 ms 2652 KB Output is correct
20 Correct 2 ms 2652 KB Output is correct
21 Correct 2 ms 2680 KB Output is correct
22 Correct 106 ms 2648 KB Output is correct
23 Correct 108 ms 2648 KB Output is correct
24 Correct 107 ms 2668 KB Output is correct
25 Correct 107 ms 2648 KB Output is correct
26 Correct 108 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 14264 KB Output is correct
2 Correct 91 ms 14144 KB Output is correct
3 Correct 79 ms 13904 KB Output is correct
4 Correct 77 ms 14280 KB Output is correct
5 Execution timed out 3040 ms 10072 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Execution timed out 3072 ms 7512 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3017 ms 13376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 1 ms 2520 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 4 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2528 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 2 ms 2652 KB Output is correct
20 Correct 2 ms 2652 KB Output is correct
21 Correct 2 ms 2680 KB Output is correct
22 Correct 106 ms 2648 KB Output is correct
23 Correct 108 ms 2648 KB Output is correct
24 Correct 107 ms 2668 KB Output is correct
25 Correct 107 ms 2648 KB Output is correct
26 Correct 108 ms 2652 KB Output is correct
27 Correct 4 ms 2908 KB Output is correct
28 Correct 3 ms 2908 KB Output is correct
29 Correct 3 ms 2652 KB Output is correct
30 Correct 542 ms 2804 KB Output is correct
31 Correct 550 ms 2648 KB Output is correct
32 Correct 536 ms 2808 KB Output is correct
33 Correct 29 ms 8256 KB Output is correct
34 Correct 35 ms 8272 KB Output is correct
35 Correct 37 ms 8136 KB Output is correct
36 Execution timed out 3021 ms 7248 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 1 ms 2520 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 2 ms 2396 KB Output is correct
5 Correct 4 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2528 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 2 ms 2652 KB Output is correct
20 Correct 2 ms 2652 KB Output is correct
21 Correct 2 ms 2680 KB Output is correct
22 Correct 106 ms 2648 KB Output is correct
23 Correct 108 ms 2648 KB Output is correct
24 Correct 107 ms 2668 KB Output is correct
25 Correct 107 ms 2648 KB Output is correct
26 Correct 108 ms 2652 KB Output is correct
27 Correct 85 ms 14264 KB Output is correct
28 Correct 91 ms 14144 KB Output is correct
29 Correct 79 ms 13904 KB Output is correct
30 Correct 77 ms 14280 KB Output is correct
31 Execution timed out 3040 ms 10072 KB Time limit exceeded
32 Halted 0 ms 0 KB -