# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
548732 | 2022-04-14T10:57:09 Z | jack715 | Lightning Rod (NOI18_lightningrod) | C++14 | 1864 ms | 262144 KB |
#include <bits/stdc++.h> #define ll long long #define pb push_back #define pp pop_back #define mp make_pair #define bb back #define ff first #define ss second using namespace std; bool protect(pair<int, int>& a, pair<int, int>& b) { return (abs(a.ff-b.ff) <= a.ss-b.ss); } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, a, b, ans = 1; cin >> n; stack<pair<int, int> > select; vector<pair<int, int> > nums(n), prot(n); for (int i = 0; i < n; i++) { cin >> nums[i].ff >> nums[i].ss; prot[i] = nums[i]; } select.push(nums[0]); for (int i = 1; i < n; i++) { if (!select.empty() && protect(select.top(), nums[i])) continue; while (!select.empty() && protect(nums[i], select.top())) select.pop(); select.push(nums[i]); } cout << select.size() << '\n'; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1824 ms | 262144 KB | Output is correct |
2 | Correct | 1787 ms | 262144 KB | Output is correct |
3 | Correct | 1689 ms | 259300 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 232 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 232 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 328 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 232 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 328 KB | Output is correct |
14 | Correct | 53 ms | 4672 KB | Output is correct |
15 | Correct | 44 ms | 4840 KB | Output is correct |
16 | Correct | 40 ms | 5356 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1553 ms | 207604 KB | Output is correct |
2 | Correct | 1591 ms | 230692 KB | Output is correct |
3 | Correct | 1493 ms | 218960 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1824 ms | 262144 KB | Output is correct |
2 | Correct | 1787 ms | 262144 KB | Output is correct |
3 | Correct | 1689 ms | 259300 KB | Output is correct |
4 | Correct | 1 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 232 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 328 KB | Output is correct |
17 | Correct | 53 ms | 4672 KB | Output is correct |
18 | Correct | 44 ms | 4840 KB | Output is correct |
19 | Correct | 40 ms | 5356 KB | Output is correct |
20 | Correct | 1553 ms | 207604 KB | Output is correct |
21 | Correct | 1591 ms | 230692 KB | Output is correct |
22 | Correct | 1493 ms | 218960 KB | Output is correct |
23 | Correct | 1864 ms | 172052 KB | Output is correct |
24 | Correct | 1714 ms | 152192 KB | Output is correct |
25 | Correct | 1842 ms | 262144 KB | Output is correct |