Submission #743083

#TimeUsernameProblemLanguageResultExecution timeMemory
743083JooLightning Rod (NOI18_lightningrod)C++17
80 / 100
2082 ms116428 KiB
#include <bits/stdc++.h> using namespace std; const int MXN = 1e7 + 10; int x[MXN], y[MXN]; int main() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; stack<int> st; for (int i = 1; i <= n; i++) { cin >> x[i] >> y[i]; while (!st.empty() and x[i] - x[st.top()] <= y[i] - y[st.top()]) st.pop(); if (st.empty() or !(x[i] - x[st.top()] <= y[st.top()] - y[i])) st.push(i); } cout << st.size() << "\n"; }
#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...