Submission #341158

#TimeUsernameProblemLanguageResultExecution timeMemory
341158ommivorousLightning Rod (NOI18_lightningrod)C++14
80 / 100
2083 ms192352 KiB
#include <bits/stdc++.h> using namespace std; stack<pair<int,int> >s; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=0;i<n;i++){ int x,y; cin>>x>>y; bool add=1; while(s.size()){ int tx=s.top().first,ty=s.top().second; if(x-tx<=ty-y){add=0;break;} if(x-tx<=y-ty)s.pop(); else break; } if(add)s.push(make_pair(x,y)); } printf("%d",(int)s.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...