제출 #919716

#제출 시각아이디문제언어결과실행 시간메모리
919716AnasAAFAdvertisement 2 (JOI23_ho_t2)C++14
59 / 100
2009 ms8272 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); for(int i=0;i<n;i++){ ll a, b;cin>>a>>b; v[i] = {a, b}; vp[i] = {b, {a, i}}; } 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<<ans<<endl; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:22:13: warning: unused variable 'a' [-Wunused-variable]
   22 |         int a = vp[i].second.first, b = vp[i].first, ind = vp[i].second.second;
      |             ^
Main.cpp:22:37: warning: unused variable 'b' [-Wunused-variable]
   22 |         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...