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>
const int MOD = 1e9+7;
using namespace std;
void solve(){
vector<pair<int, int>> v;
int n, x, e;
cin >> n;
while(n--){
cin >> x >> e;
v.emplace_back(e+x, e-x);
}
sort(v.begin(), v.end());
int ans = 0;
while(!v.empty()){
ans++;
e = v.back().second;
v.pop_back();
while(!v.empty() && v.back().second <= e) v.pop_back();
}
cout << ans << '\n';
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}
# | 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... |