Submission #978006

#TimeUsernameProblemLanguageResultExecution timeMemory
978006alexddpopa (BOI18_popa)C++17
37 / 100
173 ms444 KiB
#include "popa.h"
#include<bits/stdc++.h>
using namespace std;
int tole[1005],tori[1005];
int calc(int le, int ri)
{
    if(le>ri)
        return -1;
    for(int root=le;root<=ri;root++)
    {
        if(query(root,root,le,ri))
        {
            tole[root] = calc(le,root-1);
            tori[root] = calc(root+1,ri);
            return root;
        }
    }
}
int solve(int N, int* Left, int* Right)
{
    for(int i=0;i<N;i++)
        tole[i]=tori[i]=-1;
    int root = calc(0,N-1);
    for(int i=0;i<N;i++)
    {
        Left[i]=tole[i];
        Right[i]=tori[i];
    }
    return root;
}

Compilation message (stderr)

popa.cpp: In function 'int calc(int, int)':
popa.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...