Submission #854407

#TimeUsernameProblemLanguageResultExecution timeMemory
854407annabeth9680Lightning Rod (NOI18_lightningrod)C++17
100 / 100
1402 ms189284 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e7+11; int P[MAXN][2]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int N; cin >> N; int ans = 0; for(int i = 0;i<N;++i){ int x,y; cin >> x >> y; while(ans > 0 && abs(P[ans-1][0]-x) <= y-P[ans-1][1]) ans--; if(ans > 0 && abs(P[ans-1][0]-x) <= P[ans-1][1]-y) continue; P[ans][0] = x, P[ans][1] = y; ans++; } cout << ans << "\n"; return 0; }
#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...