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>
#include <iomanip>
#define ll long long
//#define int long long
#define pb push_back
#define F first
#define S second
#define st string
#define pii pair<int,int>
#define sz(x) x.size()
#define all(x) x.begin(), x.end()
#define vi vector<int>
#define mii map<int,int>
#define mll map<ll,ll>
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
#define lf else if
using namespace std;
signed main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
//srand( time(0));
//freopen("sum.in", "r", stdin);
//freopen("sum.out", "w", stdout);
ll tests=1;
//cin>>tests;
for(ll i=1;i<=tests;i++)
{
//cout<<"Case "<<i<<":\n";
ll n;
cin>>n;
vector <pair <ll,ll> > v(n);
map <ll,ll> mp;
for(ll i=0;i<n;i++)
{
cin>>v[i].S>>v[i].F;
}
ll an=0;
if(n>2000){cout<<n;return 0;}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(ll i=0;i<n;i++)
{
for(ll j=i+1;j<n;j++)
{
if(abs(v[i].S-v[j].S)<=v[i].F-v[j].F && i!=j)mp[j]+=1;
}
}
for(ll i=0;i<n;i++)
{
if(mp[i]==0)an++;
}
cout<<an;
}
}
# | 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... |