Submission #743792

#TimeUsernameProblemLanguageResultExecution timeMemory
743792vjudge1Lightning Rod (NOI18_lightningrod)C++17
11 / 100
1434 ms82880 KiB
#include <bits/stdc++.h> #define x first #define y second using namespace std; stack<pair<int,int>> st; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; while (n--) { int a,b; cin >> a >> b; while (!st.empty() && abs(a - st.top().x) <= abs(b - st.top().y)) st.pop(); if (st.empty() || (!st.empty() && abs(a - st.top().x) > abs(b - st.top().y))) st.push({a, b}); } cout << st.size(); 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...