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 ll long long
#define pb push_back
#define ff first
#define ss second
using namespace std ;
const int N = 1e5 + 5;
int main ()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n ;
cin >> n ;
vector<pair<ll, ll>>v;
set<pair<ll, ll>, greater<pair<ll, ll>>>s;
for (int i = 0; i < n; i++)
{
ll x, y ;
cin >> x >> y ;
v.pb({x, y});
s.insert({y, x});
}
int count = 0;
while (!s.empty())
{
count++;
pair<ll, ll>temp = (*(s.begin()));
ll y = temp.ff;
ll x = temp.ss;
s.erase(*(s.begin()));
for (int i = 0; i < n; i++)
{
ll x1 = v[i].ff;
ll y1 = v[i].ss;
if (abs(x - x1) <= y - y1)
{
auto it = s.find({y1, x1});
if (it != s.end())
{
s.erase(it);
}
}
}
}
cout << count << "\n";
}
# | 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... |