답안 #1094742

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1094742 2024-09-30T12:33:07 Z asli_bg 비밀 (JOI14_secret) C++11
컴파일 오류
0 ms 0 KB
#pragma GCC optimize("O3,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

#define int long long

#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
 
#define FOR(i,a) for(int i=0;i<(a);i++)
#define FORE(i,a,b) for(int i=(a);i<(b);i++)
#define cont(x) {for(auto el:x) cout<<el<<' ';cout<<endl;}
#define contp(x) {for(auto el:x) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;}
#define sp <<" "<<
#define mid (l+r)/2
#define endl '\n'
 
#define DEBUG(X) {cout<<#X<<' '<<(X)<<endl;}
 
#define carp(x,y) ((x%MOD)*(y%MOD))%MOD
#define topla(x,y) ((x%MOD)+(y%MOD))%MOD
 
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;

const int MAXN=1e3+2;
const int MAXK=10;

#include "secret.h"

vi a;
int n;
int tut[MAXK][MAXN];
int mask[MAXN];

void dq(int l,int r,int lev){
    if(l>=r) return;

    tut[lev][mid]=a[mid];
    tut[lev][mid+1]=a[mid+1];

    for(int i=mid-1;i>=l;i--){
        tut[lev][i]=Secret(tut[lev][i+1],a[i]);
    }
    for(int i=mid+2;i<=r;i++){
        tut[lev][i]=Secret(tut[lev][i-1],a[i]);
    }

    FORE(i,mid+1,r+1) mask[i]=mask[i]^(1<<lev);

    dq(l,mid,lev+1);
    dq(mid+1,r,lev+1);
}


void Init(int N, int A[]) {
    Secret(0, 1000000000);
    n=N;
    a.pb(0);
    FOR(i,N){
        a.pb(A[i]);
    }

    dq(1,n,1);
}

int Query(int l, int r) {
    l++; r++;
    if(l==r) return a[l];
    int bits=__builtin_ctz(mask[l]^mask[r]);
    return Secret(tut[bits][l],tut[bits][r]);
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccSbxoqP.o: in function `main':
grader.cpp:(.text.startup+0x2a8): undefined reference to `Init(int, int*)'
/usr/bin/ld: grader.cpp:(.text.startup+0x30b): undefined reference to `Query(int, int)'
/usr/bin/ld: /tmp/ccdmg4bM.o: in function `dq(long long, long long, long long)':
secret.cpp:(.text+0xf1): undefined reference to `Secret(long long, long long)'
/usr/bin/ld: secret.cpp:(.text+0x149): undefined reference to `Secret(long long, long long)'
/usr/bin/ld: secret.cpp:(.text+0x164): undefined reference to `Secret(long long, long long)'
/usr/bin/ld: secret.cpp:(.text+0x17f): undefined reference to `Secret(long long, long long)'
/usr/bin/ld: secret.cpp:(.text+0x19a): undefined reference to `Secret(long long, long long)'
/usr/bin/ld: /tmp/ccdmg4bM.o:secret.cpp:(.text+0x1b5): more undefined references to `Secret(long long, long long)' follow
collect2: error: ld returned 1 exit status