Submission #824434

#TimeUsernameProblemLanguageResultExecution timeMemory
824434christinelynnLightning Rod (NOI18_lightningrod)C++17
40 / 100
2071 ms262144 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; bool ok=1; for(int i=1; i<=n; i++) { int x, y; cin >> x >> y; if(y!=1) ok=0; s.insert({y, x}); } if(ok) { cout << n << endl; return; } 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...