Submission #393308

#TimeUsernameProblemLanguageResultExecution timeMemory
393308parsabahramiCircle selection (APIO18_circle_selection)C++17
7 / 100
3076 ms14944 KiB
/* There's someone in my head but it's not me */ #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define SZ(x) (int) x.size() #define F first #define S second const int N = 3e5 + 10, MOD = 1e9 + 7; int n, X[N], Y[N], R[N], ord[N], ret[N]; int intersect(int i, int j) { ll x1 = X[i], x2 = X[j], y1 = Y[i], y2 = Y[j], r1 = R[i], r2 = R[j]; return x1 * x1 + x2 * x2 + y1 * y1 + y2 * y2 - r1 * r1 - r2 * r2 <= 2 * (r1 * r2 + x1 * x2 + y1 * y2); } int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) scanf("%d%d%d", &X[i], &Y[i], &R[i]); iota(ord + 1, ord + n + 1, 1); sort(ord + 1, ord + n + 1, [&] (int i, int j) { return R[i] == R[j] ? i < j : R[i] > R[j]; }); for (int _ = 1; _ <= n; _++) { int i = ord[_]; if (ret[i]) continue; ret[i] = i; for (int j = _ + 1; j <= n; j++) { if (!ret[ord[j]] && intersect(i, ord[j])) ret[ord[j]] = i; } } for (int i = 1; i <= n; i++) printf("%d ", ret[i]); printf("\n"); return 0; }

Compilation message (stderr)

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