제출 #1269847

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

int solve(int N, int* Left, int* Right) {
    stack<int>s;
    s.push(0);
    for(int i=0; i<N; i++) {
        Left[i] = -1;
        Right[i] = -1;
    }
    for(int i=1; i<N; i++) {
        int last=-1;
        while(s.size() and query(s.top(), i, i, i)) {
            prev=s.top();
            s.pop();
        }
        Left[i] = prev;
        if(s.size()) Right[s.top()] = i;
        s.push(i);
    }
    while(s.size() > 1) s.pop();
    return s.top();
}

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

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:15:24: error: overloaded function with no contextual type information
   15 |             prev=s.top();
      |                        ^
popa.cpp:18:19: error: cannot resolve overloaded function 'prev' based on conversion to type 'int'
   18 |         Left[i] = prev;
      |                   ^~~~