Submission #743056

#TimeUsernameProblemLanguageResultExecution timeMemory
743056JooLightning Rod (NOI18_lightningrod)C++17
80 / 100
2009 ms80016 KiB
#include <bits/stdc++.h> using namespace std; bool isContain(pair<int, int> &a, pair<int, int> &b) { return (abs(a.first - b.first) <= a.second - b.second); } int main() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; stack<pair<int, int>> st; for (int i = 1; i <= n; i++) { pair<int, int> tmp; cin >> tmp.first >> tmp.second; while (!st.empty() and isContain(tmp, st.top())) st.pop(); if (st.empty() or !isContain(st.top(), tmp)) st.push(tmp); } 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...