Submission #865320

#TimeUsernameProblemLanguageResultExecution timeMemory
865320Trisanu_DasLightning Rod (NOI18_lightningrod)C++17
40 / 100
2055 ms250352 KiB
# 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 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...