Submission #494523

# Submission time Handle Problem Language Result Execution time Memory
494523 2021-12-15T16:51:29 Z blue Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1890 ms 229500 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;

using pii = pair<int, int>;
#define sz(x) int(x.size())

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

    int N;
    cin >> N;

    vector<pii> P;

    int u, v;
    cin >> u >> v;
    P.push_back({u, v});

    for(int i = 2; i <= N; i++)
    {
        int x, y;
        cin >> x >> y;
        if(abs(x - P.back().first) <= P.back().second - y) continue;
        while(!P.empty() && abs(P.back().first - x) <= y - P.back().second)
            P.pop_back();
        P.push_back({x, y});
    }

    cout << sz(P) << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1590 ms 229352 KB Output is correct
2 Correct 1595 ms 229500 KB Output is correct
3 Correct 1514 ms 229392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 316 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 41 ms 3884 KB Output is correct
15 Correct 37 ms 3636 KB Output is correct
16 Correct 36 ms 3808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1610 ms 145664 KB Output is correct
2 Correct 1510 ms 145436 KB Output is correct
3 Correct 1464 ms 141892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1590 ms 229352 KB Output is correct
2 Correct 1595 ms 229500 KB Output is correct
3 Correct 1514 ms 229392 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 316 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 41 ms 3884 KB Output is correct
18 Correct 37 ms 3636 KB Output is correct
19 Correct 36 ms 3808 KB Output is correct
20 Correct 1610 ms 145664 KB Output is correct
21 Correct 1510 ms 145436 KB Output is correct
22 Correct 1464 ms 141892 KB Output is correct
23 Correct 1890 ms 175364 KB Output is correct
24 Correct 1890 ms 151736 KB Output is correct
25 Correct 1767 ms 135012 KB Output is correct