# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
672963 | 2022-12-19T08:07:08 Z | vuavisao | Lightning Rod (NOI18_lightningrod) | C++14 | 1773 ms | 262144 KB |
#include<bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define ll long long using namespace std; const int N = 1e7 + 10; const int INF = 2e9 + 10; struct Point { int x = 0, y = 0; Point() {}; Point(int _x, int _y) { x = _x; y = _y; }; }; int n; Point p[N]; int pred[N], suf[N]; int res; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen("NOI18_lightningrod.inp", "r")) { freopen("NOI18_lightningrod.inp", "r", stdin); freopen("NOI18_lightningrod.out", "w", stdout); } cin >> n; for(int i = 1; i <= n; ++ i) { int x, y; cin >> x >> y; p[i] = Point(x + y, x - y); } pred[0] = - INF; for(int i = 1; i <= n; ++ i) { pred[i] = max(pred[i - 1], p[i].x); } suf[n + 1] = INF; for(int i = n; i >= 1; -- i) { suf[i] = min(suf[i + 1], p[i].y); } for(int i = 1; i <= n; ++ i) { bool have_left = (pred[i] > pred[i - 1]); bool have_right = (suf[i] < suf[i + 1]); res += (have_left & have_right); } cout << res; return 0; } /// Code by vuavisao
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1383 ms | 237908 KB | Output is correct |
2 | Correct | 1422 ms | 239988 KB | Output is correct |
3 | Correct | 1373 ms | 235492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 78520 KB | Output is correct |
2 | Correct | 47 ms | 78500 KB | Output is correct |
3 | Correct | 48 ms | 78524 KB | Output is correct |
4 | Correct | 47 ms | 78544 KB | Output is correct |
5 | Correct | 47 ms | 78564 KB | Output is correct |
6 | Correct | 47 ms | 78484 KB | Output is correct |
7 | Correct | 48 ms | 78540 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 78520 KB | Output is correct |
2 | Correct | 47 ms | 78500 KB | Output is correct |
3 | Correct | 48 ms | 78524 KB | Output is correct |
4 | Correct | 47 ms | 78544 KB | Output is correct |
5 | Correct | 47 ms | 78564 KB | Output is correct |
6 | Correct | 47 ms | 78484 KB | Output is correct |
7 | Correct | 48 ms | 78540 KB | Output is correct |
8 | Correct | 48 ms | 78508 KB | Output is correct |
9 | Correct | 48 ms | 78472 KB | Output is correct |
10 | Correct | 50 ms | 78612 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 78520 KB | Output is correct |
2 | Correct | 47 ms | 78500 KB | Output is correct |
3 | Correct | 48 ms | 78524 KB | Output is correct |
4 | Correct | 47 ms | 78544 KB | Output is correct |
5 | Correct | 47 ms | 78564 KB | Output is correct |
6 | Correct | 47 ms | 78484 KB | Output is correct |
7 | Correct | 48 ms | 78540 KB | Output is correct |
8 | Correct | 48 ms | 78508 KB | Output is correct |
9 | Correct | 48 ms | 78472 KB | Output is correct |
10 | Correct | 50 ms | 78612 KB | Output is correct |
11 | Correct | 47 ms | 78504 KB | Output is correct |
12 | Correct | 47 ms | 78540 KB | Output is correct |
13 | Correct | 51 ms | 78488 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 49 ms | 78520 KB | Output is correct |
2 | Correct | 47 ms | 78500 KB | Output is correct |
3 | Correct | 48 ms | 78524 KB | Output is correct |
4 | Correct | 47 ms | 78544 KB | Output is correct |
5 | Correct | 47 ms | 78564 KB | Output is correct |
6 | Correct | 47 ms | 78484 KB | Output is correct |
7 | Correct | 48 ms | 78540 KB | Output is correct |
8 | Correct | 48 ms | 78508 KB | Output is correct |
9 | Correct | 48 ms | 78472 KB | Output is correct |
10 | Correct | 50 ms | 78612 KB | Output is correct |
11 | Correct | 47 ms | 78504 KB | Output is correct |
12 | Correct | 47 ms | 78540 KB | Output is correct |
13 | Correct | 51 ms | 78488 KB | Output is correct |
14 | Correct | 83 ms | 79956 KB | Output is correct |
15 | Correct | 81 ms | 80056 KB | Output is correct |
16 | Correct | 79 ms | 80160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1367 ms | 227452 KB | Output is correct |
2 | Correct | 1344 ms | 229332 KB | Output is correct |
3 | Correct | 1287 ms | 225512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1383 ms | 237908 KB | Output is correct |
2 | Correct | 1422 ms | 239988 KB | Output is correct |
3 | Correct | 1373 ms | 235492 KB | Output is correct |
4 | Correct | 49 ms | 78520 KB | Output is correct |
5 | Correct | 47 ms | 78500 KB | Output is correct |
6 | Correct | 48 ms | 78524 KB | Output is correct |
7 | Correct | 47 ms | 78544 KB | Output is correct |
8 | Correct | 47 ms | 78564 KB | Output is correct |
9 | Correct | 47 ms | 78484 KB | Output is correct |
10 | Correct | 48 ms | 78540 KB | Output is correct |
11 | Correct | 48 ms | 78508 KB | Output is correct |
12 | Correct | 48 ms | 78472 KB | Output is correct |
13 | Correct | 50 ms | 78612 KB | Output is correct |
14 | Correct | 47 ms | 78504 KB | Output is correct |
15 | Correct | 47 ms | 78540 KB | Output is correct |
16 | Correct | 51 ms | 78488 KB | Output is correct |
17 | Correct | 83 ms | 79956 KB | Output is correct |
18 | Correct | 81 ms | 80056 KB | Output is correct |
19 | Correct | 79 ms | 80160 KB | Output is correct |
20 | Correct | 1367 ms | 227452 KB | Output is correct |
21 | Correct | 1344 ms | 229332 KB | Output is correct |
22 | Correct | 1287 ms | 225512 KB | Output is correct |
23 | Correct | 1773 ms | 262144 KB | Output is correct |
24 | Correct | 1669 ms | 262144 KB | Output is correct |
25 | Correct | 1650 ms | 262144 KB | Output is correct |