Submission #393328

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3933282021-04-23 07:59:42Nima_NaderiCircle selection (APIO18_circle_selection)C++14
7 / 100
81 ms836 KiB
//In the name of God
//#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
const ll MXN = 5e3 + 10;
ll n;
ll X[MXN], Y[MXN], R[MXN], A[MXN];
bool Crs(ll i, ll j){
ll dis = (X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]);
return (dis <= (R[j] + R[i]) * (R[i] + R[j]));
}
set<pll> st;
void Rm(ll i){
auto itr = st.find({-R[i], i});
st.erase(itr);
}
int main(){
ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i ++) cin >> X[i] >> Y[i] >> R[i];
for(int i = 1; i <= n; i ++) st.insert({-R[i], i});
while(!st.empty()){
ll i = st.begin() -> second;
Rm(i), A[i] = i;
for(int j = 1; j <= n; j ++){
if(!A[j] && Crs(i, j)) A[j] = i, Rm(j);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

circle_selection.cpp: In function 'int main()':
circle_selection.cpp:32:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   32 |  for(int i = 1; i <= n; i ++) cout << A[i] << ' '; cout << '\n';
      |  ^~~
circle_selection.cpp:32:52: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   32 |  for(int i = 1; i <= n; i ++) cout << A[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...