# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
921607 | vjudge1 | Lightning Rod (NOI18_lightningrod) | C++17 | 1032 ms | 262148 KiB |
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
using namespace std;
void solve(){
ll a,ans=0;
cin>>a;
map<pair<ll,ll>,ll>mp;
vector<pair<ll,ll> > v;
for(ll i=1;i<=a;i++){
ll x,y;
cin>>x>>y;
v.pb({y,x});
}
ans=a;
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(ll i=0;i<v.size();i++){
for(ll j=i+1;j<v.size();j++){
if(mp[v[i]]==0){
if(abs(v[i].second-v[j].second)<=v[i].first-v[j].first){
mp[v[j]]=1;
ans--;
}
}
}
}
cout<<ans;
}
int main()
{
ios_base::sync_with_stdio(0),cin.tie(0);
ll t=1,i=1;
//cin>>t;
while(t--){
//cout<<"Case ";
//cout<<i<<':'<<"\n";
//i++;
solve();
}
return 0;
}
Compilation message (stderr)
# | 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... |