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 vi vector<int>
# define pb push_back
# define pii pair<int, int>
# define fi first
# define se second
# define endl '\n'
using namespace std;
int n;
set<pii> s;
signed main() {
cin >> n;
for(int i=1; i<=n; i++) {
int x, y;
cin >> x >> y;
s.insert({y, x});
}
int ans=0;
while(!s.empty()) {
pii cur=*s.rbegin();
ans++;
vector<pii> v;
for(pii i : s) if(abs(i.se-cur.se)<=(cur.fi-i.fi)) v.pb(i);
for(pii i : v) s.erase(i);
}
cout << ans << endl;
}
# | 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... |