Submission #227637

# Submission time Handle Problem Language Result Execution time Memory
227637 2020-04-28T08:13:27 Z Autoratch Lightning Rod (NOI18_lightningrod) C++14
66 / 100
2000 ms 183868 KB
#include <bits/stdc++.h>
using namespace std;

int n;
stack<pair<int,int> > a;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n;
    for(int i = 0;i < n;i++)
    {
        int x,y;
        cin >> x >> y;
        while(!a.empty() and abs(a.top().first-x)<=y-a.top().second) a.pop();
        if(a.empty() or abs(a.top().first-x)>a.top().second-y) a.push({x,y});
    }
    cout << a.size();
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2095 ms 183868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 480 KB Output is correct
9 Correct 5 ms 416 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 480 KB Output is correct
9 Correct 5 ms 416 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 480 KB Output is correct
9 Correct 5 ms 416 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 63 ms 3960 KB Output is correct
15 Correct 55 ms 3704 KB Output is correct
16 Correct 50 ms 3832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2096 ms 147688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2095 ms 183868 KB Time limit exceeded
2 Halted 0 ms 0 KB -