Submission #1063859

#TimeUsernameProblemLanguageResultExecution timeMemory
1063859LuvidiLightning Rod (NOI18_lightningrod)C++17
100 / 100
1153 ms157148 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll, ll> #define pii pair<int, int> #define fs first #define sc second #define pb push_back void solve() { int n; cin>>n; int ans=0,x1; vector<int> st; while(n--){ int x,y; cin>>x>>y; if(!ans){ ans++; x1=x+y; st.pb(y-x); continue; } if(x+y<=x1)continue; x1=max(x1,x+y); while(!st.empty()&&st.back()<=y-x)st.pop_back(); st.push_back(y-x); } cout<<st.size(); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); }
#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...