Submission #742916

# Submission time Handle Problem Language Result Execution time Memory
742916 2023-05-17T06:05:58 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1763 ms 174996 KB
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
 
    int N;
    cin >> N;
 
    stack <pair <int, int>> stk;
    for(int i = 1; i <= N; i++) {
        int x, y;
        cin >> x >> y;
 
        while(!stk.empty() and stk.top().first >= x - y) {
            stk.pop();
        }
        if(stk.empty() or stk.top().second < x + y) {
            stk.emplace(x - y, x + y);
        }
    }
    cout << stk.size();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1486 ms 174996 KB Output is correct
2 Correct 1429 ms 157564 KB Output is correct
3 Correct 1453 ms 157168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 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 0 ms 212 KB Output is correct
7 Correct 0 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 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 0 ms 212 KB Output is correct
7 Correct 0 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 360 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 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 0 ms 212 KB Output is correct
7 Correct 0 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 360 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 36 ms 3756 KB Output is correct
15 Correct 37 ms 3532 KB Output is correct
16 Correct 34 ms 3656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1342 ms 147376 KB Output is correct
2 Correct 1419 ms 121056 KB Output is correct
3 Correct 1400 ms 117948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1486 ms 174996 KB Output is correct
2 Correct 1429 ms 157564 KB Output is correct
3 Correct 1453 ms 157168 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 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 0 ms 212 KB Output is correct
10 Correct 0 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 212 KB Output is correct
14 Correct 1 ms 360 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 36 ms 3756 KB Output is correct
18 Correct 37 ms 3532 KB Output is correct
19 Correct 34 ms 3656 KB Output is correct
20 Correct 1342 ms 147376 KB Output is correct
21 Correct 1419 ms 121056 KB Output is correct
22 Correct 1400 ms 117948 KB Output is correct
23 Correct 1753 ms 98192 KB Output is correct
24 Correct 1763 ms 136568 KB Output is correct
25 Correct 1643 ms 121952 KB Output is correct