This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |