Submission #743995

# Submission time Handle Problem Language Result Execution time Memory
743995 2023-05-18T07:04:05 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
0 / 100
1594 ms 133768 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;
        vec.push_back({a,b});
    }
    for(int i=0;i<n;++i)
    {
        while(!st.empty() && vec[i].y-st.top().y >= st.top().x-vec[i].x) st.pop();
        if(st.empty() || !(vec[i].y-st.top().y >= st.top().x-vec[i].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 Incorrect 1594 ms 133768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1549 ms 132280 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1594 ms 133768 KB Output isn't correct
2 Halted 0 ms 0 KB -