Submission #578664

# Submission time Handle Problem Language Result Execution time Memory
578664 2022-06-17T13:31:08 Z FatihSolak popa (BOI18_popa) C++17
0 / 100
1000 ms 262144 KB
#include <bits/stdc++.h>
#include "popa.h"
#define N 1005
using namespace std;
int L[N],R[N];
int rgroup[N];
bool ok[N];
int f(int l,int r){
    if(l > r)return -1;
    for(int i = l;i<=r;i++){
        if((rgroup[i] == rgroup[r] && ok[i]) || (l == r)){
            L[i] = f(l,i-1);
            R[i] = f(i+1,r);
            return i;
        }
    }
}
int solve(int n, int* Left, int* Right){
    for(int i = 0;i<n;i++){
        L[i] = R[i] = -1;
    }
    int cnt = 1;
    for(int i = 0;i<n;i++){
        int r = i;
        while(r + 1 != n && query(i,r+1,i,i))
            r++;
        for(int j = i;j<=r;j++){
            rgroup[j] = cnt; 
            ok[j] = query(i,i,j,j);
        }
        cnt++;
        i = r;
    }
    int ret = f(0,n-1);
    for(int i = 0;i<n;i++){
        Left[i] = L[i];
        Right[i] = R[i];
    }
    return ret;
}

Compilation message

popa.cpp: In function 'int f(int, int)':
popa.cpp:17:1: warning: control reaches end of non-void function [-Wreturn-type]
   17 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2832 ms 262144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2753 ms 262144 KB Time limit exceeded
2 Halted 0 ms 0 KB -