Submission #313314

# Submission time Handle Problem Language Result Execution time Memory
313314 2020-10-15T17:22:32 Z kaplanbar Lightning Rod (NOI18_lightningrod) C++14
80 / 100
2000 ms 42232 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    stack<int> s;
    int mx = -2e9;
    for(int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      while(!s.empty() && s.top() <= y-x) {
        s.pop();
      }
      if(mx < y + x) s.push(y - x), mx = y + x;
    }
    cout << s.size() << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1753 ms 42232 KB Output is correct
2 Correct 1656 ms 41968 KB Output is correct
3 Correct 1645 ms 40956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 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 1 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 0 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 1 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 0 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 1 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 0 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 67 ms 2168 KB Output is correct
15 Correct 44 ms 2048 KB Output is correct
16 Correct 41 ms 2432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1747 ms 27972 KB Output is correct
2 Correct 1696 ms 28048 KB Output is correct
3 Correct 1638 ms 27312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1753 ms 42232 KB Output is correct
2 Correct 1656 ms 41968 KB Output is correct
3 Correct 1645 ms 40956 KB Output is correct
4 Correct 1 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 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 0 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 67 ms 2168 KB Output is correct
18 Correct 44 ms 2048 KB Output is correct
19 Correct 41 ms 2432 KB Output is correct
20 Correct 1747 ms 27972 KB Output is correct
21 Correct 1696 ms 28048 KB Output is correct
22 Correct 1638 ms 27312 KB Output is correct
23 Execution timed out 2078 ms 2296 KB Time limit exceeded
24 Halted 0 ms 0 KB -