제출 #1300591

#제출 시각아이디문제언어결과실행 시간메모리
1300591danglayloi1Lightning Rod (NOI18_lightningrod)C++20
80 / 100
1095 ms79816 KiB
#include <bits/stdc++.h> #define ii pair<int, int> #define fi first #define se second #define inf 0x3f3f3f3f3f3f3f3f using namespace std; using ll = long long; const ll mod=1e9+7; const int nx=1e7+5; int n, ans=0, cur=-1, x, y; stack<ii> st; ii p; bool ok; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(int i = 1; i <= n; i++) { cin>>x>>y; ok=1; while(st.size()) { p=st.top(); if(x-p.fi<=p.se-y) { ok=0; break; } if(x-p.fi<=y-p.se) st.pop(); else break; } if(ok) st.push({x, y}); } cout<<st.size(); }
#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...