제출 #393335

#제출 시각아이디문제언어결과실행 시간메모리
393335Nima_Naderi원 고르기 (APIO18_circle_selection)C++14
12 / 100
1530 ms70368 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 = 3e5 + 10; ll n; ll X[MXN], R[MXN], A[MXN]; set<pll> st, stR, stL; void Rm(ll i){ auto itr = st.find({-R[i], i}); st.erase(itr); itr = stR.find({X[i] + R[i], i}); stR.erase(itr); itr = stL.find({X[i] - R[i], i}); stL.erase(itr); } int main(){ ios::sync_with_stdio(0);cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i ++){ ll y; cin >> X[i] >> y >> R[i]; assert(y == 0); } for(int i = 1; i <= n; i ++){ st.insert({-R[i], i}); stL.insert({X[i] - R[i], i}); stR.insert({X[i] + R[i], i}); } while(!st.empty()){ ll i = st.begin() -> second; Rm(i), A[i] = i; ll l = X[i] - R[i], r = X[i] + R[i]; auto itr = stL.lower_bound({l, -1}); while(itr != stL.end() && itr -> first <= r){ ll id = itr -> second; A[id] = i; Rm(id); itr = stL.lower_bound({l, -1}); } itr = stR.lower_bound({l, -1}); while(itr != stR.end() && itr -> first <= r){ ll id = itr -> second; A[id] = i; Rm(id); itr = stR.lower_bound({l, -1}); } } 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:49:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   49 |  for(int i = 1; i <= n; i ++) cout << A[i] << ' '; cout << '\n';
      |  ^~~
circle_selection.cpp:49:52: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   49 |  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...