제출 #406627

#제출 시각아이디문제언어결과실행 시간메모리
406627ScarletS비밀 (JOI14_secret)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> int n, a[1000], pre[1000][1000]; void build(int l, int r) { if (l+1>=r) return; int m=l+(r-l)/2; pre[m][m]=a[m]; pre[m+1][m+1]=a[m]; for (int i=m-1;i>=l;--i) pre[i][m]=Secret(a[i],pre[i+1][m]); for (int i=m+2;i<=r;++i) pre[m+1][i]=Secret(pre[m+1][i-1],a[i]); build(l,m); build(m+1,r); } void Init(int N, int A[]) { n=N; for (int i=0;i<n;++i) a[i]=A[i]; build(0,1,n); } int Query(int l, int r) { if (l+1<=r) return Secret(a[l],a[r]); int x=0, y=n-1, m; while (1) { m=x+(y-x)/2; if (l<=m&&m<r) return Secret(pre[l][m],pre[m+1][r]); if (m<l&&m<r) x=m+1; else y=m; } }

컴파일 시 표준 에러 (stderr) 메시지

secret.cpp: In function 'void build(int, int)':
secret.cpp:13:19: error: 'Secret' was not declared in this scope
   13 |         pre[i][m]=Secret(a[i],pre[i+1][m]);
      |                   ^~~~~~
secret.cpp:15:21: error: 'Secret' was not declared in this scope
   15 |         pre[m+1][i]=Secret(pre[m+1][i-1],a[i]);
      |                     ^~~~~~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:25:16: error: too many arguments to function 'void build(int, int)'
   25 |     build(0,1,n);
      |                ^
secret.cpp:5:6: note: declared here
    5 | void build(int l, int r)
      |      ^~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:31:16: error: 'Secret' was not declared in this scope
   31 |         return Secret(a[l],a[r]);
      |                ^~~~~~
secret.cpp:37:20: error: 'Secret' was not declared in this scope
   37 |             return Secret(pre[l][m],pre[m+1][r]);
      |                    ^~~~~~