Submission #969989

#TimeUsernameProblemLanguageResultExecution timeMemory
969989steveonalexCircle selection (APIO18_circle_selection)C++17
7 / 100
3072 ms14280 KiB
#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 (stderr)

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";
      |                                                      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...