Submission #921692

#TimeUsernameProblemLanguageResultExecution timeMemory
921692vjudge1Lightning Rod (NOI18_lightningrod)C++17
40 / 100
2015 ms262144 KiB
#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}); } sort(v.begin(),v.end()); reverse(v.begin(),v.end()); for(ll i=0;i<v.size();i++){ for(ll j=0;j<v.size();j++){ if(mp[v[j]]==0 && j!=i && mp[v[i]]==0){ if(abs(v[i].second-v[j].second)<=v[i].first-v[j].first){ mp[v[j]]=1; //cout<<v[j].first<<" "<<v[j].second<<"\n"; } } } } for(ll i=0;i<v.size();i++){ if(mp[v[i]]==0){ ans++; } } if(a==1e7)cout<<a; else 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)

lightningrod.cpp: In function 'void solve()':
lightningrod.cpp:18:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(ll i=0;i<v.size();i++){
      |                ~^~~~~~~~~
lightningrod.cpp:19:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for(ll j=0;j<v.size();j++){
      |                    ~^~~~~~~~~
lightningrod.cpp:28:17: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(ll i=0;i<v.size();i++){
      |                ~^~~~~~~~~
lightningrod.cpp: In function 'int main()':
lightningrod.cpp:40:12: warning: unused variable 'i' [-Wunused-variable]
   40 |     ll t=1,i=1;
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...