제출 #624093

#제출 시각아이디문제언어결과실행 시간메모리
624093Arnch원 고르기 (APIO18_circle_selection)C++17
7 / 100
3089 ms996232 KiB
// oooo /* har chi delet mikhad bebar ~ gitar o ba khodet nabar! ~ ;Amoo_Hasan; */ #include<bits/stdc++.h> //#pragma GCC optimize("O3,no-stack-protector,unroll-loops") //#pragma GCC target("avx2,fma") using namespace std; typedef long long ll; typedef long double ld; #define Sz(x) int((x).size()) #define All(x) (x).begin(), (x).end() #define wtf(x) cout<<#x <<" : " <<x <<endl constexpr ll inf = 1e18, N = 1e6 + 10, mod = 1e9 + 7, pr = 1000696969; int x[N], y[N], r[N], ans[N]; bool mark[N]; vector<int> adj[N]; bool Ok(int i, int j) { ll cur = 1ll * (x[i] - x[j]) * (x[i] - x[j]); cur += 1ll * (y[i] - y[j]) * (y[i] - y[j]); if(cur <= 1ll * (r[i] + r[j]) * (r[i] + r[j])) return true; return false; } bool cmp(int i, int j) { return r[i] > r[j]; } int main() { ios :: sync_with_stdio(0), cin.tie(0); int n; cin >>n; for(int i = 0; i < n; i++) cin >>x[i] >>y[i] >>r[i]; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) { if(Ok(i, j)) { adj[i].push_back(j); adj[j].push_back(i); } } vector<int> vc; for(int i = 0; i < n; i++) vc.push_back(i); sort(All(vc), cmp); for(auto i : vc) { if(mark[i]) continue; ans[i] = i; for(auto j : adj[i]) { if(!mark[j]) { mark[j] = 1; ans[j] = i; } } } for(int i = 0; i < n; i++) cout<<ans[i] + 1 <<' '; return 0; }
#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...