Submission #169232

#TimeUsernameProblemLanguageResultExecution timeMemory
169232aggu_01000101Lightning Rod (NOI18_lightningrod)C++14
66 / 100
2059 ms153292 KiB
#include <iostream> #include <algorithm> #include <cmath> #include <unordered_map> #include <fstream> #include <stack> #include <vector> #include <set> #include <queue> #include <cstdlib> #include <cstring> #include <map> #define int long long using namespace std; int32_t main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; stack<pair<int, int>> st; for(int i =0 ;i<n;i++){ int x, y; cin>>x>>y; bool toadd = true; bool cont = true; while(st.size() && cont){ if(abs(x - st.top().first)<=(st.top().second - y)) toadd = cont = false; else if(abs(x - st.top().first)<=(y-st.top().second)) st.pop(); else cont = false; } if(toadd) st.push(make_pair(x, y)); } cout<<st.size()<<endl; }
#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...