제출 #919651

#제출 시각아이디문제언어결과실행 시간메모리
919651Younis_DwaiAdvertisement 2 (JOI23_ho_t2)C++14
69 / 100
2016 ms75428 KiB
#include <bits/stdc++.h> //#define int long long #define ll long long #define in insert #define F first #define S second #define pb push_back #define endl "\n" #define mid (l+r)/2 #define pop pop_back //#define all(v) v.begin(),v.end() using namespace std; const int M=998244353; int n,ans=0; multiset<pair<int,int>> s; set<int> ss; map<int,int> mp; int32_t main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for(int i=1;i<=n;i++){ int X,E;cin>>X>>E; s.in({E,X}); ss.in(X); mp[E]++; } if(mp.size()==1){ cout<<ss.size(); return 0; } while(!s.empty()){ ans++; pair<int,int> x=*prev(s.end()); vector<pair<int,int>> v; for(auto u : s){ if(abs(u.S-x.S)<=x.F-u.F) v.pb(u); } for(auto u : v) s.erase(s.find(u)); } cout<<ans; 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...