# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
313299 | 2020-10-15T17:09:31 Z | kaplanbar | Lightning Rod (NOI18_lightningrod) | C++14 | 2000 ms | 85040 KB |
#include <bits/stdc++.h> using namespace std; #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") using ll = long long; constexpr int N = 1e7+1; int n; pair<int,int> a[N]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n; for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } vector<bool> v(n, 0); int mx = -2e9; for(int i = 0; i < n; i++) { int val = a[i].first + a[i].second; if(mx >= val) { v[i] = 1; } else { mx = val; } } mx = -2e9; for(int i = n - 1; i >= 0; i--) { int val = a[i].second - a[i].first; if(mx >= val) { v[i] = 1; } else { mx = val; } } int ans = 0; for(int i = 0; i < n; i++) ans += 1^v[i]; cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1701 ms | 81016 KB | Output is correct |
2 | Correct | 1679 ms | 80760 KB | Output is correct |
3 | Correct | 1658 ms | 78584 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Correct | 0 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 0 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 44 ms | 5368 KB | Output is correct |
15 | Correct | 46 ms | 5240 KB | Output is correct |
16 | Correct | 42 ms | 4624 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1750 ms | 82320 KB | Output is correct |
2 | Correct | 1739 ms | 82424 KB | Output is correct |
3 | Correct | 1680 ms | 80132 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1701 ms | 81016 KB | Output is correct |
2 | Correct | 1679 ms | 80760 KB | Output is correct |
3 | Correct | 1658 ms | 78584 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 0 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 0 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 384 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 0 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 384 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 384 KB | Output is correct |
17 | Correct | 44 ms | 5368 KB | Output is correct |
18 | Correct | 46 ms | 5240 KB | Output is correct |
19 | Correct | 42 ms | 4624 KB | Output is correct |
20 | Correct | 1750 ms | 82320 KB | Output is correct |
21 | Correct | 1739 ms | 82424 KB | Output is correct |
22 | Correct | 1680 ms | 80132 KB | Output is correct |
23 | Execution timed out | 2091 ms | 85040 KB | Time limit exceeded |
24 | Halted | 0 ms | 0 KB | - |