답안 #269040

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
269040 2020-08-17T04:54:18 Z wutwere Lightning Rod (NOI18_lightningrod) C++17
80 / 100
2000 ms 132088 KB
#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;
	vector<pair<int, int>> ans;
	FOR (n) {
		int x, y; cin >> x >> y;
		if (!ans.empty() && abs(x - ans[0].first) <= y - ans[0].second) {
			ans.clear();
		}
		pair<int, int> top;
		auto end = --ans.begin();
		for (auto it = --ans.end(); it != end; it--) {
			top = *it;
			if (abs(x - top.first) > y - top.second) {
				ans.erase(++it, ans.end());
				break;
			}
		}
		if (ans.empty() || abs(top.first - x) > top.second - y) ans.pb({x, y});
	}
	cout << ans.size() << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1814 ms 132080 KB Output is correct
2 Correct 1788 ms 132044 KB Output is correct
3 Correct 1721 ms 132088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 44 ms 464 KB Output is correct
15 Correct 44 ms 504 KB Output is correct
16 Correct 41 ms 1660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1837 ms 66272 KB Output is correct
2 Correct 1989 ms 66488 KB Output is correct
3 Correct 1767 ms 66616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1814 ms 132080 KB Output is correct
2 Correct 1788 ms 132044 KB Output is correct
3 Correct 1721 ms 132088 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 44 ms 464 KB Output is correct
18 Correct 44 ms 504 KB Output is correct
19 Correct 41 ms 1660 KB Output is correct
20 Correct 1837 ms 66272 KB Output is correct
21 Correct 1989 ms 66488 KB Output is correct
22 Correct 1767 ms 66616 KB Output is correct
23 Execution timed out 2005 ms 1156 KB Time limit exceeded
24 Halted 0 ms 0 KB -