제출 #1138017

#제출 시각아이디문제언어결과실행 시간메모리
1138017ConquerConquererpopa (BOI18_popa)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "popa.h"
using namespace std;

stack<int> st;

int solve(int N, int* L, int* R) {
    st.clear();
    
    int root = -1;

    for (int i = 0; i < N; i++)
        L[i] = R[i] = -1;

    for (int i = 0; i < N; i++) {
        while (st.size() && query(st.top(), i, i, i)) {
            R[st.top()] = -1;
            L[i] = st.top();
            st.pop();
        }

        if (st.empty()) root = i;
            else R[st.top()] = i;
        st.push(i);
    }

    return root;
}

컴파일 시 표준 에러 (stderr) 메시지

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:8:8: error: 'class std::stack<int>' has no member named 'clear'
    8 |     st.clear();
      |        ^~~~~