답안 #70244

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70244 2018-08-22T14:07:03 Z Pajaraja 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
int v[1007][1007],a[1007],n;void t(int l,int r){int s=(l+r)/2;for(int i=s-1;i>=l;i--)v[i][s]=Secret(a[i],val[i+1][s]);for(int i=s+2;i<=r;i++)v[s+1][i]=Secret(v[s+1][i-1],a[i]);if(l==r)return;t(l,s);t(s+1,r);}void Init(int N,int A[]){n=N;for(int i=0;i<n;i++)v[i][i]=a[i]=A[i];t(0,n-1);}int b(int l,int r,int lt,int rt){if(l==r) return a[l];int s=(l+r)/2;if(lt<=s&&rt>s)return Secret(val[lt][s],val[s+1][rt]);if(rt<=s)return b(l,s,lt,rt);return b(s+1,r,lt,rt);}int Query(int L, int R){return b(0,n-1,L,R);}

Compilation message

secret.cpp: In function 'void t(int, int)':
secret.cpp:2:106: error: 'val' was not declared in this scope
 int v[1007][1007],a[1007],n;void t(int l,int r){int s=(l+r)/2;for(int i=s-1;i>=l;i--)v[i][s]=Secret(a[i],val[i+1][s]);for(int i=s+2;i<=r;i++)v[s+1][i]=Secret(v[s+1][i-1],a[i]);if(l==r)return;t(l,s);t(s+1,r);}void Init(int N,int A[]){n=N;for(int i=0;i<n;i++)v[i][i]=a[i]=A[i];t(0,n-1);}int b(int l,int r,int lt,int rt){if(l==r) return a[l];int s=(l+r)/2;if(lt<=s&&rt>s)return Secret(val[lt][s],val[s+1][rt]);if(rt<=s)return b(l,s,lt,rt);return b(s+1,r,lt,rt);}int Query(int L, int R){return b(0,n-1,L,R);}
                                                                                                          ^~~
secret.cpp: In function 'int b(int, int, int, int)':
secret.cpp:2:383: error: 'val' was not declared in this scope
 int v[1007][1007],a[1007],n;void t(int l,int r){int s=(l+r)/2;for(int i=s-1;i>=l;i--)v[i][s]=Secret(a[i],val[i+1][s]);for(int i=s+2;i<=r;i++)v[s+1][i]=Secret(v[s+1][i-1],a[i]);if(l==r)return;t(l,s);t(s+1,r);}void Init(int N,int A[]){n=N;for(int i=0;i<n;i++)v[i][i]=a[i]=A[i];t(0,n-1);}int b(int l,int r,int lt,int rt){if(l==r) return a[l];int s=(l+r)/2;if(lt<=s&&rt>s)return Secret(val[lt][s],val[s+1][rt]);if(rt<=s)return b(l,s,lt,rt);return b(s+1,r,lt,rt);}int Query(int L, int R){return b(0,n-1,L,R);}
                                                                                                                                                                                                                                                                                                                                                                                               ^~~