Submission #361720

#TimeUsernameProblemLanguageResultExecution timeMemory
361720wildturtleLightning Rod (NOI18_lightningrod)C++14
80 / 100
2050 ms79972 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,n; bool l; stack < pair <int , int > > st; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(int i=1;i<=n;i++) { cin>>a>>b; l=0; while(!st.empty()) { c=st.top().first; d=st.top().second; if(a+b<=c+d) { l=1; break; } if(a-b<=c-d) st.pop(); else break; } if(l==0) st.push({a,b}); } cout<<st.size(); }
#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...