Submission #515940

#TimeUsernameProblemLanguageResultExecution timeMemory
515940JooLightning Rod (NOI18_lightningrod)C++17
100 / 100
1851 ms192504 KiB
#include <bits/stdc++.h> using namespace std; int main(void){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; stack<pair<int, int>> st; for(int i = 1; i <= n; i++){ int x, y; cin >> x >> y; while(!st.empty() and x-st.top().first <= y-st.top().second) st.pop(); if(st.empty() or (x-st.top().first > y-st.top().second and x-st.top().first > st.top().second-y)) st.push({x, y}); } cout << st.size(); 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...