Submission #249426

# Submission time Handle Problem Language Result Execution time Memory
249426 2020-07-15T02:00:09 Z thebes popa (BOI18_popa) C++14
0 / 100
19 ms 384 KB
#include "popa.h"
#include <bits/stdc++.h>
using namespace std;

const int MN = 1005;
int i, cur, par[MN];

int solve(int N,int *L,int *R){
    for(i=0;i<N;i++)
        par[i]=L[i]=R[i]=-1;
    for(i=1;i<N;i++){
        if(query(cur,i,i,i)){
            if(par[cur]==-1){
                L[i] = cur;
                par[cur] = i;
                cur = i;
            }
            else{
                cur = par[cur];
                i--;
            }
        }
        else{
            if(~R[cur]){
                L[i]=R[cur];
                par[L[i]]=i;
            }
            R[cur] = i;
            par[i] = cur;
            cur = i;
        }
    }
    while(~par[cur]) cur=par[cur];
    return cur;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB invalid argument
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 384 KB invalid argument
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 384 KB invalid argument
2 Halted 0 ms 0 KB -