Submission #743063

#TimeUsernameProblemLanguageResultExecution timeMemory
743063JooLightning Rod (NOI18_lightningrod)C++17
80 / 100
2011 ms115888 KiB
#include <bits/stdc++.h> using namespace std; const int MXN = 1e7 + 10; int x[MXN], y[MXN]; inline bool isContain(int i, int j) { return (abs(x[i] - x[j]) <= y[i] - y[j]); } 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 isContain(i, st.top())) st.pop(); if (st.empty() or !isContain(st.top(), 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...