제출 #1365037

#제출 시각아이디문제언어결과실행 시간메모리
1365037hyyhLightning Rod (NOI18_lightningrod)C++20
66 / 100
1097 ms36168 KiB
#include <iostream>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <cstring>
#include <iomanip>
#include <set>
#include <bitset>
#include <unordered_map>

using namespace std;
using ll = long long;
using pii = pair<int,int>;
using piii = tuple<int,int,int>;
#define f first
#define s second
#define endl '\n'
#define all(x) begin(x),end(x)
#define m_p make_pair

int main(){
    int n;cin >> n;
    stack<pii> st;
    for(int i{};i < n;i++){
        int x,y;cin >> x >> y;
        while(!st.empty() && x-st.top().f <= y-st.top().s) st.pop();
        if(!(!st.empty() && x-st.top().f <= st.top().s-y)) st.emplace(x,y);
    }
    cout << st.size();
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…