# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
183947 | 2020-01-10T08:34:50 Z | duttaditya18 | Lightning Rod (NOI18_lightningrod) | C++17 | 983 ms | 201268 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second // #define getchar_unlocked getchar void fastscan(int &x) { bool neg=false; register int c; x =0; c=getchar_unlocked(); if(c=='-') { neg = true; c=getchar_unlocked(); } for(;(c>47 && c<58);c=getchar_unlocked()) x = (x<<1) + (x<<3) +c -48; if(neg) x *=-1; } int main(void) { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; fastscan(n); // x, y int x, y; pair<int, int> p[n + 1]; for(int i = 1; i <= n; i++) { fastscan(p[i].fi); fastscan(p[i].se); } int suf[n + 2] = {}; int prf[n + 2] = {}; prf[0] = INT_MIN; prf[n + 1] = INT_MIN; suf[0] = INT_MAX; suf[n + 1] = INT_MAX; for(int i = 1; i <= n; i++) prf[i] = max(prf[i - 1], p[i].fi + p[i].se); for(int i = n; i >= 1; i--) suf[i] = min(suf[i + 1], p[i].fi - p[i].se); int ans = n; for(int i = 1; i <= n; i++) ans -= ((p[i].fi + p[i].se <= prf[i - 1]) || (p[i].fi - p[i].se >= suf[i + 1])); cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 622 ms | 168312 KB | Output is correct |
2 | Correct | 620 ms | 163832 KB | Output is correct |
3 | Correct | 619 ms | 157816 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 0 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 0 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 0 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 3 ms | 468 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 0 ms | 380 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 1 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 3 ms | 468 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 20 ms | 6776 KB | Output is correct |
15 | Correct | 20 ms | 6776 KB | Output is correct |
16 | Correct | 19 ms | 5928 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 596 ms | 165904 KB | Output is correct |
2 | Correct | 598 ms | 165244 KB | Output is correct |
3 | Correct | 585 ms | 161272 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 622 ms | 168312 KB | Output is correct |
2 | Correct | 620 ms | 163832 KB | Output is correct |
3 | Correct | 619 ms | 157816 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 0 ms | 380 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 1 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 380 KB | Output is correct |
14 | Correct | 3 ms | 468 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 20 ms | 6776 KB | Output is correct |
18 | Correct | 20 ms | 6776 KB | Output is correct |
19 | Correct | 19 ms | 5928 KB | Output is correct |
20 | Correct | 596 ms | 165904 KB | Output is correct |
21 | Correct | 598 ms | 165244 KB | Output is correct |
22 | Correct | 585 ms | 161272 KB | Output is correct |
23 | Correct | 855 ms | 160168 KB | Output is correct |
24 | Correct | 983 ms | 201268 KB | Output is correct |
25 | Correct | 792 ms | 181552 KB | Output is correct |