답안 #439832

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
439832 2021-06-30T23:42:44 Z julian33 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
    cerr<<vars<<" = ";
    string delim="";
    (...,(cerr<<delim<<values,delim=", "));
    cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif

#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);} 

const int mxN=1e3+5;

int a[mxN],pieceofshit[mxN][10],n;

Secret(int X,int Y);

// int Secret(int x,int y){
//     return x^y;
// }

void build(int v,int l,int r){
    if(l>=r)
        return;
    int mid=(l+r)>>1;
    build(v+1,l,mid);
    build(v+1,mid+1,r);
    pieceofshit[mid][v]=a[mid];
    pieceofshit[mid+1][v]=a[mid+1];
    for(int i=mid-1;i>=l;i--){
        assert(pieceofshit[i+1][v]<=1e9);
        pieceofshit[i][v]=Secret(pieceofshit[i+1][v],a[i]);
    }
    for(int i=mid+2;i<=r;i++){
        assert(pieceofshit[i-1][v]<=1e9);
        pieceofshit[i][v]=Secret(pieceofshit[i-1][v],a[i]);
    }
}

int query(int v,int l,int r,int lq,int rq){
    int mid=(l+r)>>1;
    if(lq>mid+1)
        return query(v+1,mid+1,r,lq,rq);
    if(rq<mid)
        return query(v+1,l,mid,lq,rq);
    if(lq<=mid && rq>mid){
        assert(pieceofshit[lq][v]<=1e9);
        assert(pieceofshit[rq][v]<=1e9);
        return Secret(pieceofshit[lq][v],pieceofshit[rq][v]);
    }
    if(lq==mid+1)
        return pieceofshit[rq][v];
    if(rq==mid)
        return pieceofshit[lq][v];
    assert(false);
}

int Query(int L, int R){
    if(L==R)
        return a[L];
    return query(0,0,n-1,L,R);
}

void Init(int N, int A[]){
    for(int i=0;i<N;i++)
        a[i]=A[i];
    build(0,0,N-1);
    n=N;
}

Compilation message

secret.cpp:32:20: error: expected constructor, destructor, or type conversion before ';' token
   32 | Secret(int X,int Y);
      |                    ^
secret.cpp: In function 'void build(int, int, int)':
secret.cpp:48:27: error: 'Secret' was not declared in this scope
   48 |         pieceofshit[i][v]=Secret(pieceofshit[i+1][v],a[i]);
      |                           ^~~~~~
secret.cpp:52:27: error: 'Secret' was not declared in this scope
   52 |         pieceofshit[i][v]=Secret(pieceofshit[i-1][v],a[i]);
      |                           ^~~~~~
secret.cpp: In function 'int query(int, int, int, int, int)':
secret.cpp:65:16: error: 'Secret' was not declared in this scope
   65 |         return Secret(pieceofshit[lq][v],pieceofshit[rq][v]);
      |                ^~~~~~