Submission #743973

# Submission time Handle Problem Language Result Execution time Memory
743973 2023-05-18T06:51:57 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
7 / 100
2000 ms 32236 KB
#include<bits/stdc++.h>
using namespace std;

struct point
{
    int x,y;
};

int n;
vector<point> vec;

int cnt = 0;

int main()
{
//    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    stack<point> st;
    for(int i=0;i<n;++i)
    {
        int a,b;
        cin >> a >> b;
//        cout << '\n';
        if(!st.empty() && b > st.top().y && b-st.top().y >= abs(a-st.top().x))
        {
//            cout << "pop " << st.top().x << " " << st.top().y << '\n';
            st.pop();
            st.push({a,b});
        }
        else if(!st.empty() && st.top().y > b && abs(st.top().x-a) <= st.top().y-b) continue;
        else if(st.empty() || abs(a-st.top().x) > st.top().y-b)
        {
            st.push({a,b});
//            cout << "add " << a << " " << b << '\n';
        }
    }
    cout << st.size();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2072 ms 32236 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 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 0 ms 212 KB Output is correct
4 Correct 0 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 0 ms 212 KB Output is correct
4 Correct 0 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 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 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 0 ms 212 KB Output is correct
4 Correct 0 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 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 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 0 ms 212 KB Output is correct
4 Correct 0 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 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2053 ms 22696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2072 ms 32236 KB Time limit exceeded
2 Halted 0 ms 0 KB -