Submission #1269847

#TimeUsernameProblemLanguageResultExecution timeMemory
1269847glupanpopa (BOI18_popa)C++20
Compilation error
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();
}

Compilation message (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;
      |                   ^~~~