제출 #733892

#제출 시각아이디문제언어결과실행 시간메모리
733892vjudge1Lightning Rod (NOI18_lightningrod)C++17
100 / 100
1828 ms175888 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; int a, b; cin >> a >> b; st.push({a, b}); for (int i = 1; i < n; i++) { cin >> a >> b; while (!st.empty()) { int x = check(st.top(), {a, b}); if (x == 0) {st.push({a, b}); break ;} if (x == 1) break ; st.pop(); if (st.empty()) st.push({a, b}); } } 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...