제출 #268931

#제출 시각아이디문제언어결과실행 시간메모리
268931wutwereLightning Rod (NOI18_lightningrod)C++17
80 / 100
2070 ms135472 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define _F(i,a,b,s) for(int i=(a);((s)>0?i<(b):i>(b));i+=(s))
#define _1(e) _F(i,0,e,1)
#define _2(i,e) _F(i,0,e,1)
#define _3(i,b,e) _F(i,b,e,(b)<(e)?1:-1)
#define _G(a,b,c,d,e,...) e
#define FOR(...) _G(__VA_ARGS__,_F,_3,_2,_1)(__VA_ARGS__)

int main() {
	ios::sync_with_stdio(0),cin.tie(0);
	int n; cin >> n;
	stack<pair<int, int>> ans;
	FOR (n) {
		int x, y; cin >> x >> y;
		while (!ans.empty() && abs(x - ans.top().first) <= y - ans.top().second) ans.pop();
		if (ans.empty() || abs(ans.top().first - x) > ans.top().second - y) ans.push({x, y});
	}
	cout << ans.size() << '\n';
}
#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...