답안 #1100932

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1100932 2024-10-15T04:26:44 Z doducanh 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
///breaker
#include<secret.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define ii pair<int,int>
#define mp make_pair
#define in(x) freopen(x,"r",stdin)
#define out(x) freopen(x,"w",stdout)
#define bit(x,i) ((x>>i)&1)
#define lc (id<<1)
#define rc ((id<<1)^1)
const int maxn=1005;
int pre[maxn][maxn];
int a[maxn];
int n;
void dac(int l,int r)
{
    if(l>r)return;
    int m=(l+r)/2;
    pre[m][m]=a[m];
    pre[m+1][m+1]=a[m+1];
    for(int i=l;i<=m-1;i++){
        pre[i][m]=Secret(a[i],pre[m][m+1]);
    }
    for(int i=m+2;i<=r;i++){
        pre[m][i]=Secret(pre[m+1][i-1],a[i]);
    }
    dac(l,m-1);
    dac(m+1,r);
}
void Init(int N,int A[])
{
    n=N;
    for(int i=0;i<n;i++){
        a[i]=A[i];
    }
    dac(0,n-1);
}
int Query(int l,int r)
{
    int lo=0,hi=n-1;
    while(lo<=hi){
        int m=(lo+hi)/2;
        if(m>=l&&m<r){
            return Secret(pre[m][l],pre[m+1][r]);
        }
        else if(m==r){
            return Secret(pre[m][l]);
        }
        else if(m<l){
            lo=m+1;
        }
        else hi=m-1;
    }
}
/* stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN
 * DON'T GET STUCK ON ONE APPROACH
 */

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:51:36: error: too few arguments to function 'int Secret(int, int)'
   51 |             return Secret(pre[m][l]);
      |                                    ^
In file included from secret.cpp:2:
secret.h:7:5: note: declared here
    7 | int Secret(int X, int Y);
      |     ^~~~~~