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 fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ll long long
#define F first
#define S second
using namespace std;
const int N = 1e7 + 5, MOD = 1e9 + 7;
void solve(){
int n;
cin >> n;
pair<int, int> a[n];
for(int i = 0; i < n; ++i)
cin >> a[i].S >> a[i].F;
sort(a, a + n, greater<pair<int, int> >());
int pre = 0, ans = 1, i = 1;
while(i < n){
if(a[pre].F - a[i].F < abs(a[i].S - a[pre].S)){
++ans;
pre = i;
}
++i;
}
cout << ans << '\n';
}
int main(){
fast;
int t = 1;
// cin >> t;
while(t--)
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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |