답안 #169229

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169229 2019-12-19T07:19:49 Z aggu_01000101 Lightning Rod (NOI18_lightningrod) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <fstream>
#include <vector>
#include <set>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <map>
#define int long long
using namespace std;
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    stack<pair<int, int>> st;
    for(int i =0 ;i<n;i++){
        int x, y;
        cin>>x>>y;
        while(!st.empty()){
            if(abs(x - st.top().first)<=(st.top().second - y)) goto nopush;
            if(abs(x - st.top().first)<=(y-st.top().second)) st.pop();
            else goto push;
        }
        push:
        st.push(make_pair(x, y));
        nopush:
        continue;
    }
    cout<<st.size()<<endl;
}

Compilation message

lightningrod.cpp: In function 'int32_t main()':
lightningrod.cpp:20:5: error: 'stack' was not declared in this scope
     stack<pair<int, int>> st;
     ^~~~~
lightningrod.cpp:20:5: note: suggested alternative: 'obstack'
     stack<pair<int, int>> st;
     ^~~~~
     obstack
lightningrod.cpp:20:24: error: expected primary-expression before '>' token
     stack<pair<int, int>> st;
                        ^~
lightningrod.cpp:20:27: error: 'st' was not declared in this scope
     stack<pair<int, int>> st;
                           ^~