답안 #496847

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
496847 2021-12-22T05:21:11 Z SirCovidThe19th Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1692 ms 88000 KB
#include <bits/stdc++.h>
using namespace std; 

#define FOR(i, x, y) for (int i = x; i < y; i++)
#define pii pair<int, int>
#define f first
#define s second

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); 
    int n; cin >> n; 
    bool covered[n] = {}; pii A[n]; int H = -1; 
    FOR(i, 0, n){
        cin >> A[i].f >> A[i].s;
        if (A[i].f + A[i].s <= H) covered[i] = 1; //covered by something before
        else H = A[i].f + A[i].s;
    }
    H = 2e9;
    for (int i = n - 1; ~i; i--){ 
        if (A[i].f - A[i].s >= H) covered[i] = 1; //covered by something after
        else H = A[i].f - A[i].s;
    }
    cout<<n - accumulate(covered, covered + n, 0)<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1323 ms 85916 KB Output is correct
2 Correct 1305 ms 85620 KB Output is correct
3 Correct 1347 ms 83168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 33 ms 1908 KB Output is correct
15 Correct 41 ms 2008 KB Output is correct
16 Correct 32 ms 1868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1432 ms 88000 KB Output is correct
2 Correct 1415 ms 87936 KB Output is correct
3 Correct 1300 ms 85828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1323 ms 85916 KB Output is correct
2 Correct 1305 ms 85620 KB Output is correct
3 Correct 1347 ms 83168 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 33 ms 1908 KB Output is correct
18 Correct 41 ms 2008 KB Output is correct
19 Correct 32 ms 1868 KB Output is correct
20 Correct 1432 ms 88000 KB Output is correct
21 Correct 1415 ms 87936 KB Output is correct
22 Correct 1300 ms 85828 KB Output is correct
23 Correct 1673 ms 80076 KB Output is correct
24 Correct 1692 ms 80196 KB Output is correct
25 Correct 1556 ms 80852 KB Output is correct