Submission #53149

# Submission time Handle Problem Language Result Execution time Memory
53149 2018-06-28T20:57:44 Z okaybody10 Secret (JOI14_secret) C++
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int N,B[1006],ans[1006][1006];
void init(int s,int e)
{
    int m=(s+e)>>1;
    ans[m][m]=B[m];
    if(s==e) return;
    ans[m+1][m+1]=B[m+1];
    for(int i=m-1;i>=s;i--) ans[i][m]=Secret(ans[i+1][m],B[i]);
    for(int i=m+2;i<=e;i++) ans[m+1][i]=Secret(ans[m+1][i-1],B[i]);
    init(s,m),init(m+1,e);
}
void Init(int N,int A[])
{
    for(int i=0;i<N;i++) B[i]=A[i];
    init(0,n-1);
}
int Query(int l,int r)
{
    return solve(l,r,0,n-1);
}
int solve(int l,int r,int s,int e)
{
    int m=(s+e)>>1;
    if(l<=m && m+1<=r) return Secret(ans[l][m],ans[m+1][r]);
    if(!(m+1<=r)) solve(l,r,s,m);
    else solve(l,r,m+1,e);
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:18:12: error: 'n' was not declared in this scope
     init(0,n-1);
            ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:22:24: error: 'n' was not declared in this scope
     return solve(l,r,0,n-1);
                        ^
secret.cpp:22:12: error: 'solve' was not declared in this scope
     return solve(l,r,0,n-1);
            ^~~~~
secret.cpp: In function 'int solve(int, int, int, int)':
secret.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^