Submission #742916

#TimeUsernameProblemLanguageResultExecution timeMemory
742916vjudge1Lightning Rod (NOI18_lightningrod)C++17
100 / 100
1763 ms174996 KiB
#include <bits/stdc++.h> using namespace std; int main() { cin.tie(nullptr)->sync_with_stdio(false); int N; cin >> N; stack <pair <int, int>> stk; for(int i = 1; i <= N; i++) { int x, y; cin >> x >> y; while(!stk.empty() and stk.top().first >= x - y) { stk.pop(); } if(stk.empty() or stk.top().second < x + y) { stk.emplace(x - y, x + y); } } cout << stk.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...