Submission #744007

# Submission time Handle Problem Language Result Execution time Memory
744007 2023-05-18T07:09:31 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1729 ms 155636 KB
    #include<bits/stdc++.h>
    using namespace std;

    struct point
    {
        int x,y;
    };

    int n;
    vector<point> vec;
    stack<point> st;
    int cnt = 0;

    int main()
    {
        ios_base::sync_with_stdio(0); cin.tie(0);
        cin >> n;
        for(int i=0;i<n;++i)
        {
            int a,b;
            cin >> a >> b;
            vec.push_back({a,b});
        }
        for(int i=0;i<n;++i)
        {
            while(!st.empty() && vec[i].y-st.top().y >= abs(vec[i].x-st.top().x)) st.pop();
            if(st.empty() || !(st.top().y-vec[i].y >= abs(vec[i].x-st.top().x)))
            {
    //            cout << "add " << vec[i].x << " " << vec[i].y << '\n';
                st.push({vec[i].x,vec[i].y});
            }
        }
        cout << st.size();
        return 0;
    }
# Verdict Execution time Memory Grader output
1 Correct 1568 ms 155636 KB Output is correct
2 Correct 1527 ms 155216 KB Output is correct
3 Correct 1411 ms 150960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 34 ms 2512 KB Output is correct
15 Correct 41 ms 2472 KB Output is correct
16 Correct 34 ms 2412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1501 ms 131868 KB Output is correct
2 Correct 1485 ms 131800 KB Output is correct
3 Correct 1433 ms 131924 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1568 ms 155636 KB Output is correct
2 Correct 1527 ms 155216 KB Output is correct
3 Correct 1411 ms 150960 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 34 ms 2512 KB Output is correct
18 Correct 41 ms 2472 KB Output is correct
19 Correct 34 ms 2412 KB Output is correct
20 Correct 1501 ms 131868 KB Output is correct
21 Correct 1485 ms 131800 KB Output is correct
22 Correct 1433 ms 131924 KB Output is correct
23 Correct 1729 ms 132020 KB Output is correct
24 Correct 1661 ms 131776 KB Output is correct
25 Correct 1593 ms 131784 KB Output is correct