답안 #1048534

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1048534 2024-08-08T08:10:02 Z lamagril Lightning Rod (NOI18_lightningrod) C++14
100 / 100
1160 ms 145616 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    cin.tie(NULL)->sync_with_stdio(false);
    int n; cin >> n;
    stack<pair<int,int>> s;
    int a,b; cin >> a >> b;
    s.push({a,b});
    for(int ti=2 ; ti<=n ; ti++){
        int a,b; cin >> a >> b;
        bool bo=false;
        while(!s.empty() && a-s.top().first<=b-s.top().second){
            s.pop();
            bo=true;
        }
        if(bo){
            s.push({a,b});
            continue;
        }
        if(abs(s.top().first-a)<=s.top().second-b){
            continue;
        }
        s.push({a,b});
    }
    cout << s.size() << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 856 ms 136596 KB Output is correct
2 Correct 864 ms 136156 KB Output is correct
3 Correct 917 ms 132344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 23 ms 3296 KB Output is correct
15 Correct 26 ms 3280 KB Output is correct
16 Correct 28 ms 3360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 914 ms 134208 KB Output is correct
2 Correct 921 ms 134248 KB Output is correct
3 Correct 905 ms 129952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 856 ms 136596 KB Output is correct
2 Correct 864 ms 136156 KB Output is correct
3 Correct 917 ms 132344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 23 ms 3296 KB Output is correct
18 Correct 26 ms 3280 KB Output is correct
19 Correct 28 ms 3360 KB Output is correct
20 Correct 914 ms 134208 KB Output is correct
21 Correct 921 ms 134248 KB Output is correct
22 Correct 905 ms 129952 KB Output is correct
23 Correct 1160 ms 145616 KB Output is correct
24 Correct 974 ms 126948 KB Output is correct
25 Correct 1002 ms 111596 KB Output is correct