Submission #1048513

#TimeUsernameProblemLanguageResultExecution timeMemory
1048513lamagrilLightning Rod (NOI18_lightningrod)C++14
4 / 100
877 ms178032 KiB
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(NULL)->sync_with_stdio(false); int n; cin >> n; stack<pair<int,int>> s; int a,b; cin >> a >> b; s.push({a,b}); for(int ti=2 ; ti<=n ; ti++){ int a,b; cin >> a >> b; bool bo=false; while(!s.empty() && a-s.top().first<=b-s.top().second){ s.pop(); b=true; } if(bo){ s.push({a,b}); continue; } if(abs(s.top().first-a)<=s.top().second-b){ continue; } s.push({a,b}); } cout << s.size() << '\n'; }
#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...