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 ii pair <int, int>
#define F first
#define S second
using namespace std;
const int mod = 1e9 + 7;
const int N = 5e5 + 5;
int n;
ii sr[N];
void solve(){
cin >> n;
for (int i = 1, x, e; i <= n; ++ i){
cin >> x >> e;
sr[i].F = e - x;
sr[i].S = e + x;
}
sort(sr + 1, sr + n + 1);
int Max = -2e9;
int ans = 0;
for (int i = n; i >= 1; -- i){
if (Max < sr[i].S){
++ ans;
Max = sr[i].S;
}
}
cout << ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
while (t --) solve();
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... |