Submission #743967

# Submission time Handle Problem Language Result Execution time Memory
743967 2023-05-18T06:49:31 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
7 / 100
2000 ms 34624 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();
        }
        else if(!st.empty() && st.top().y > b && abs(st.top().x-a) <= st.top().y-b) continue;
        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 2057 ms 34624 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 1 ms 272 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 1 ms 272 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 0 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 1 ms 272 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 0 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 1 ms 272 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 0 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2051 ms 24460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2057 ms 34624 KB Time limit exceeded
2 Halted 0 ms 0 KB -