제출 #701290

#제출 시각아이디문제언어결과실행 시간메모리
701290HanksburgerPark (BOI16_park)C++17
0 / 100
261 ms33332 KiB
#include <bits/stdc++.h> using namespace std; vector<pair<double, pair<int, int> > > vec; int x[2005], y[2005], r[2005], par[4005]; pair<pair<int, int>, int> a[100005]; bool ans[100005][5]; int p(int u) { return par[u]==u?u:(par[u]=p(par[u])); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, w, h, ind=0; cin >> n >> m >> w >> h; for (int i=1; i<=n; i++) { cin >> x[i] >> y[i] >> r[i]; for (int j=1; j<i; j++) vec.push_back({sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j], {i, j}}); vec.push_back({x[i]-r[i], {i, n*2}}); vec.push_back({y[i]-r[i], {i, n*2+1}}); vec.push_back({w-x[i]-r[i], {i, n*2+2}}); vec.push_back({h-y[i]-r[i], {i, n*2+3}}); } for (int i=1; i<=m; i++) { cin >> a[i].first.first >> a[i].first.second; a[i].second=i; } sort(vec.begin(), vec.end()); sort(a+1, a+m+1); n*=2; for (int i=1; i<=n+3; i++) par[i]=i; for (int i=1; i<=m; i++) { while (ind<vec.size() && vec[ind].first<a[i].first.first*2) { par[p(vec[ind].second.first)]=p(vec[ind].second.second); ind++; } int b=a[i].first.second-1, c=a[i].second; ans[c][b]=1; ans[c][(b+3)%4]=(p(n+b)!=p(n+(b+1)%4) && p(n+b)!=p(n+(b+2)%4) && p(n+b)!=p(n+(b+3)%4)); ans[c][(b+1)%4]=(p(n+(b+1)%4)!=p(n+b) && p(n+(b+1)%4)!=p(n+(b+2)%4) && p(n+(b+1)%4)!=p(n+(b+3)%4)); ans[c][(b+2)%4]=(p(n+(b+1)%4)!=p(n+b) && p(n+(b+1)%4)!=p(n+(b+3)%4) && p(n+(b+2)%4)!=p(n+b) && p(n+(b+2)%4)!=p(n+(b+3)%4)); } for (int i=1; i<=m; i++) { for (int j=0; j<=3; j++) if (ans[i][j]) cout << j+1; cout << '\n'; } }

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

park.cpp: In function 'int main()':
park.cpp:40:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         while (ind<vec.size() && vec[ind].first<a[i].first.first*2)
      |                ~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...