Submission #743848

#TimeUsernameProblemLanguageResultExecution timeMemory
743848vjudge1Lightning Rod (NOI18_lightningrod)C++17
4 / 100
1540 ms157680 KiB
#include<bits/stdc++.h>

using namespace std;

using ll = long long ;
using pii = pair<ll , ll> ;
using i3 = tuple<ll , ll , ll> ;

const int N = 2e5+5  ;
const int MOD = 1e9+7 ;

int n ;

map<pii , bool> vis ;

struct Points {
    int x , y ;
};

vector<Points> point ;

stack<Points> st ;

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

    cin >> n ;
    for(int i=0;i<n;i++){
        int x , y ; cin >> x >> y ;
        point.push_back({x , y}) ;
    }

    for(int i=0;i<n;i++){
        while(!st.empty() && point[i].y - st.top().y >= point[i].x - st.top().x){
            st.pop();
        }
        st.push(point[i]);
    }

    cout << st.size();
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...