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 rep(i, l, r) for(int i = l; i <= r; i ++)
#define fi first
#define se second
#define endl '\n'
using namespace std;
typedef pair<int, int> pii;
bool cmp(pii a, pii b){
if(a.first != b.first) return a.first < b.first;
return a.second > b.second;
}
void solve(){
int N; cin >> N;
vector<pii> point;
rep(i, 1, N){
int X, E;
cin >> X >> E;
point.push_back({X - E, X + E});
}
sort(point.begin(), point.end(), cmp);
int ma = -1;
int cnt = 0;
for(pii p : point){
if(ma < p.second){
ma = p.second;
cnt ++;
}
}
cout << cnt;
}
signed main(){
ios::sync_with_stdio(0);
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... |