제출 #393328

#제출 시각아이디문제언어결과실행 시간메모리
393328Nima_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);
		}
	}
	for(int i = 1; i <= n; i ++) cout << A[i] << ' '; cout << '\n';
	return 0;
}
//! N.N

컴파일 시 표준 에러 (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...