Submission #743063

# Submission time Handle Problem Language Result Execution time Memory
743063 2023-05-17T07:42:52 Z Joo Lightning Rod (NOI18_lightningrod) C++17
80 / 100
2000 ms 115888 KB
#include <bits/stdc++.h>
using namespace std;

const int MXN = 1e7 + 10;

int x[MXN], y[MXN];

inline bool isContain(int i, int j)
{
    return (abs(x[i] - x[j]) <= y[i] - y[j]);
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int n;
    cin >> n;
    stack<int> st;
    for (int i = 1; i <= n; i++)
    {
        cin >> x[i] >> y[i];
        while (!st.empty() and isContain(i, st.top()))
            st.pop();
        if (st.empty() or !isContain(st.top(), i))
            st.push(i);
    }
    cout << st.size() << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1410 ms 115888 KB Output is correct
2 Correct 1564 ms 115516 KB Output is correct
3 Correct 1339 ms 112420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 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 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 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 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 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 368 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 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 368 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 45 ms 3316 KB Output is correct
15 Correct 42 ms 3484 KB Output is correct
16 Correct 50 ms 3660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1407 ms 103788 KB Output is correct
2 Correct 1496 ms 106464 KB Output is correct
3 Correct 1425 ms 104048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1410 ms 115888 KB Output is correct
2 Correct 1564 ms 115516 KB Output is correct
3 Correct 1339 ms 112420 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 328 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 328 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 1 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 368 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 45 ms 3316 KB Output is correct
18 Correct 42 ms 3484 KB Output is correct
19 Correct 50 ms 3660 KB Output is correct
20 Correct 1407 ms 103788 KB Output is correct
21 Correct 1496 ms 106464 KB Output is correct
22 Correct 1425 ms 104048 KB Output is correct
23 Correct 1721 ms 74404 KB Output is correct
24 Correct 1959 ms 77268 KB Output is correct
25 Execution timed out 2011 ms 78840 KB Time limit exceeded
26 Halted 0 ms 0 KB -