제출 #919720

#제출 시각아이디문제언어결과실행 시간메모리
919720AnasAAFAdvertisement 2 (JOI23_ho_t2)C++14
69 / 100
2021 ms52004 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define float double int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); int n;cin>>n; vector<pair<ll, ll>>v(n); vector<pair<ll, pair<ll, ll>>>vp(n); set<int>st, st2; for(int i=0;i<n;i++){ ll a, b;cin>>a>>b; v[i] = {a, b}; vp[i] = {b, {a, i}}; st.insert(a); st2.insert(b); } if(st2.size()==1){ cout<<st.size()<<endl; return 0; } sort(vp.rbegin(), vp.rend()); vector<int>vis(n+1); int ans(0); queue<int>q; for(int i=0;i<n;i++){ int a = vp[i].second.first, b = vp[i].first, ind = vp[i].second.second; if(!vis[ind]){ ans++; q.push(ind); } while(!q.empty()){ int in = q.front(); int x = v[in].first, y=v[in].second; q.pop(); for(int j=0;j<n;j++){ if(vis[j])continue; int m = v[j].first, n=v[j].second; if(abs(x-m)<=y-n){ q.push(j); vis[j]=1; } } } } cout<<min(ans, (int)st.size())<<endl; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:29:13: warning: unused variable 'a' [-Wunused-variable]
   29 |         int a = vp[i].second.first, b = vp[i].first, ind = vp[i].second.second;
      |             ^
Main.cpp:29:37: warning: unused variable 'b' [-Wunused-variable]
   29 |         int a = vp[i].second.first, b = vp[i].first, ind = vp[i].second.second;
      |                                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...