Submission #59351

# Submission time Handle Problem Language Result Execution time Memory
59351 2018-07-21T16:32:24 Z gusfring Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
 
int n;
int f[1005][1005];
int a[1005];
 
void solve(int l, int r) {
    if (l > r) return;
    if (l == r) {
        f[l][l] = a[l]; return;
    }
    int mid = (l + r) / 2;
    solve(l, mid), solve(mid + 1, r);
    for (int i = mid - 1; i >= l; --i) {
        f[i][mid] = Secret(a[i], f[i + 1][mid]);
    }
    for (int i = mid + 2; i <= r; ++i) {
        f[mid + 1][i] = Secret(f[mid + 1][i - 1], a[i]);
    }
}

void build(int root, int lo, int hi){
	
int Query(int l, int r){
    for (int i = l; i < r; ++i){
        if (f[l][i] != -1 && f[i + 1][r] != -1){
            return Secret(f[l][i], f[i + 1][r]);
        }
    }
    return f[l][r];
}
 
void Init(int N, int A[]) {
    memset(f, -1, sizeof(f));
    n = N; for (int i = 0; i < n; ++i) a[i] = A[i];
    solve(0, n - 1);
}

Compilation message

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:26:24: error: a function-definition is not allowed here before '{' token
 int Query(int l, int r){
                        ^
secret.cpp:35:27: error: a function-definition is not allowed here before '{' token
 void Init(int N, int A[]) {
                           ^
secret.cpp:39:1: error: expected '}' at end of input
 }
 ^