Submission #824432

#TimeUsernameProblemLanguageResultExecution timeMemory
824432andecaandeciLightning Rod (NOI18_lightningrod)C++17
40 / 100
2080 ms239664 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' # define jess ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; int n; set<pii> s; void solve() { 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; } signed main() { solve(); }
#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...