Submission #49426

#TimeUsernameProblemLanguageResultExecution timeMemory
49426gs13105Circle selection (APIO18_circle_selection)C++17
7 / 100
157 ms5340 KiB
#include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <iterator> using namespace std; struct cir { int x, y, r, i; bool operator <(const cir &a) const { return r != a.r ? r > a.r : i < a.i; } }; cir arr[300010]; int num[300010]; int res[300010]; bool inter(const cir &a, const cir &b) { return 1LL * (a.x - b.x) * (a.x - b.x) + 1LL * (a.y - b.y) * (a.y - b.y) <= 1LL * (a.r + b.r) * (a.r + b.r); } int main() { //freopen("in", "r", stdin); //freopen("out", "w", stdout); int n, i, j; scanf("%d", &n); for(i = 1; i <= n; i++) { int x, y, r; scanf("%d%d%d", &x, &y, &r); arr[i] = { x, y, r, i }; } sort(arr + 1, arr + n + 1); if(n <= 5000) { for(i = 1; i <= n; i++) if(!num[i]) for(j = 1; j <= n; j++) if(!num[j] && inter(arr[i], arr[j])) num[j] = arr[i].i; for(i = 1; i <= n; i++) res[arr[i].i] = num[i]; for(i = 1; i <= n; i++) printf("%d ", res[i]); return 0; } return 0; }

Compilation message (stderr)

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:44:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
circle_selection.cpp:48:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &x, &y, &r);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#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...