제출 #1139841

#제출 시각아이디문제언어결과실행 시간메모리
1139841fcmalkcinLightning Rod (NOI18_lightningrod)C++20
0 / 100
1096 ms324 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; stack<pair<ll,ll>> st; signed main(){ ll n;cin>>n; for (ll i = 0;i<n;i++){ ll x,y;cin>>x>>y; bool checkAdd = false; while (true){ if (st.size() == 0){ st.push({x,y}); break; } ll sx = st.top().first, sy = st.top().second; if (x-sx<=sy-y) break; else if (x-sx <=y-sy) { st.pop(); checkAdd = true; } else { break; } } if (checkAdd) st.push({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...