Submission #743078

#TimeUsernameProblemLanguageResultExecution timeMemory
743078JooLightning Rod (NOI18_lightningrod)C++17
80 / 100
2012 ms124724 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 (abs(x[i] - x[st.top()]) <= y[i] - y[st.top()])) st.pop(); if (st.empty() or !(abs(x[st.top()] - x[i]) <= 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...