Submission #1089939

# Submission time Handle Problem Language Result Execution time Memory
1089939 2024-09-17T12:14:20 Z lucri popa (BOI18_popa) C++17
0 / 100
13 ms 588 KB
#include<bits/stdc++.h>
int query(int a,int b,int c,int d);
int t[1010];
int tata(int nod)
{
    if(t[nod]==0)
        return nod;
    return tata(t[nod]);
}
int solve(int N, int* Left, int* Right)
{
    int n=N;
    for(int i=0;i<n;++i)
    {
        t[i]=0;
        Left[i]=Right[i]=-1;
    }
    for(int i=0;i+1<n;++i)
    {
        if(query(i,i,i,i+1)==false&&query(i+1,i+1,i,i+1)==false)
            exit(0);
        if(query(i+1,i+1,i,i+1)==true)
        {
            int x=tata(i);
            t[x]=i+1;
            Left[i+1]=x;
        }
        else
        {
            t[i+1]=i;
            Right[i]=i+1;
        }
    }
    for(int i=0;i<n;++i)
        if(t[i]==0)
            return i;
}

Compilation message

popa.cpp: In function 'int solve(int, int*, int*)':
popa.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 588 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 344 KB too many queries
2 Halted 0 ms 0 KB -