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>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 1e7+10;
pii arr[mxn];
int N;
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>N;
for(int i = 0;i<N;i++){
cin>>arr[i].fs>>arr[i].sc;
arr[i] = make_pair(arr[i].fs-arr[i].sc,arr[i].fs+arr[i].sc);
}
sort(arr,arr+N,[](pii &a,pii &b){return a.fs == b.fs?a.sc>b.sc:a.fs<b.fs;});
int ans = 0,big = INT_MIN;
for(int i = 0;i<N;i++){
//cout<<arr[i].fs<<','<<arr[i].sc<<' ';
ans += (big<arr[i].sc);
big = (big<arr[i].sc?arr[i].sc:big);
}
cout<<ans;
}
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |