Submission #1135379

#TimeUsernameProblemLanguageResultExecution timeMemory
1135379adkjtLightning Rod (NOI18_lightningrod)C++20
0 / 100
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define f first #define s second stack<pii> st; int main() { int x,y,n; cin>>n; for(int i=1;i<=n;i++) { cin>>x>>y; while(!st.empty()&&x-st.top().f<=y-st.top().s) st.pop(); if(!st.empty()&&x-st.top().f<=st.top().s-y) continue; st.push({x,y}); } cout<<st.size(); }
#Verdict Execution timeMemoryGrader output
Fetching results...