# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
77727 |
2018-09-30T05:49:02 Z |
nxteru |
Secret (JOI14_secret) |
C++14 |
|
0 ms |
0 KB |
#include <iostream>
#include <vector>
#include "secret.h"
using namespace std;
int n,a[1005][1005];
void bt(int l,int r){
int m=(l+r)/2;
for(int i=m-1;i>=l;i--){
a[i][m]=Secret(a[i][i],a[i+1][m]);
}
for(int i=m+2;i<=r;i++){
a[m+1][i]=Secret(a[m+1][i-1],a[i][i]);
}
if(l+3<=m)bt(l,m);
if(m+4<=r)bt(m+1,r);
}
void Init(int N,vector<int>A){
n=N;
for(int i=0;i<n;i++)a[i][i]=A[i];
bt(0,n-1);
}
int ans(int L,int R,int l,int r){
int m=(l+r)/2;
if(R<m)return ans(L,R,l,m);
if(m+1<L)return ans(L,R,m+1,r);
if(R==m||L==m+1)return a[L][R];
return Secret(a[L][m],a[m+1][R]);
}
int Query(int l,int r){
return ans(l,r,0,n-1);
}
Compilation message
/tmp/cc2Hecki.o: In function `main':
grader-full.cpp:(.text.startup+0x27b): undefined reference to `Init(int, int*)'
collect2: error: ld returned 1 exit status