제출 #733828

#제출 시각아이디문제언어결과실행 시간메모리
733828vjudge1Lightning Rod (NOI18_lightningrod)C++17
4 / 100
1721 ms159120 KiB
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define int long long #define F first #define S second #define pb push_back using namespace std; stack<pair<int, int > > st; int check(pair<int, int > a, pair<int, int > b) { int c = b.F - a.F; if (a.S - b.S >= c) return 1; if (b.S - a.S >= c) return 2; return 0; } void solve() { int n; cin >> n; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; if (i == 0) {st.push({a, b}); continue ;} while (!st.empty()) { int x = check(st.top(), {a, b}); if (x == 2) st.pop(); else if (x == 1) break ; else {st.push({a, b}); break ;} } } cout << st.size(); } signed main(){IOS solve(); return 0;}
#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...