Submission #361711

#TimeUsernameProblemLanguageResultExecution timeMemory
361711wildturtleLightning Rod (NOI18_lightningrod)C++14
80 / 100
2041 ms262144 KiB
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,i,e,f,g,n,m,k,l; stack < pair <long long , long long > > st; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(long long 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...