Submission #743943

#TimeUsernameProblemLanguageResultExecution timeMemory
743943vjudge1Lightning Rod (NOI18_lightningrod)C++17
4 / 100
1369 ms80584 KiB
#include<bits/stdc++.h> using namespace std; struct point { int x,y; }; int n; vector<point> vec; int cnt = 0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; stack<point> st; for(int i=0;i<n;++i) { int a,b; cin >> a >> b; if(!st.empty() && b < st.top().y && abs(a-st.top().x) <= st.top().y-b) continue; if(!st.empty() && b == st.top().y) { ++cnt; st.push({a,b}); continue; } if(st.empty()) { ++cnt; st.push({a,b}); } } cout << cnt; 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...