Submission #667992

#TimeUsernameProblemLanguageResultExecution timeMemory
667992bashkortLightning Rod (NOI18_lightningrod)C++17
100 / 100
1582 ms76200 KiB
#include <bits/stdc++.h> using namespace std; constexpr int N = 100000000; int stk1[N], stk2[N], top = 0; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; ++i) { int x, y; cin >> x >> y; while (top > 0 && stk1[top - 1] >= x - y) { --top; } if (top == 0 || stk2[top - 1] < x + y) { stk1[top] = x - y, stk2[top] = x + y; top += 1; } } cout << top << '\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...