제출 #905061

#제출 시각아이디문제언어결과실행 시간메모리
905061nguyentunglam원 고르기 (APIO18_circle_selection)C++17
7 / 100
3097 ms18644 KiB
#include<bits/stdc++.h> #define all(v) v.begin(), v.end() #define endl "\n" #define int long long using namespace std; const int N = 3e5 + 10; int n; int x[N], y[N], r[N]; int ans[N]; int32_t main() { #define task "" cin.tie(0) -> sync_with_stdio(0); if (fopen("task.inp", "r")) { freopen("task.inp", "r", stdin); freopen("task.out", "w", stdout); } if (fopen(task".inp", "r")) { freopen (task".inp", "r", stdin); freopen (task".out", "w", stdout); } cin >> n; for(int i = 1; i <= n; i++) cin >> x[i] >> y[i] >> r[i]; while (1) { int idx = 0; for(int i = 1; i <= n; i++) if (!ans[i]) if (r[i] > r[idx]) idx = i; if (idx == 0) break; for(int i = 1; i <= n; i++) if (!ans[i]) { int dist = (x[i] - x[idx]) * (x[i] - x[idx]) + (y[i] - y[idx]) * (y[i] - y[idx]); if (dist <= (r[i] + r[idx]) * (r[i] + r[idx])) ans[i] = idx; } } for(int i = 1; i <= n; i++) cout << ans[i] << " "; }

컴파일 시 표준 에러 (stderr) 메시지

circle_selection.cpp: In function 'int32_t main()':
circle_selection.cpp:21:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |     freopen("task.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
circle_selection.cpp:22:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     freopen("task.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
circle_selection.cpp:26:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |     freopen (task".inp", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
circle_selection.cpp:27:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     freopen (task".out", "w", stdout);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...