Submission #930257

# Submission time Handle Problem Language Result Execution time Memory
930257 2024-02-19T08:02:12 Z dead0ne Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#include "secret.h"
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define endl "\n"
#define all(x) x.begin(), x.end()
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
#define lim 1005
using namespace std;

int n;
int dat[10][lim], arr[lim], mask[lim];

void divi(int l, int r, int lev){
  if(l>=r) return;
  int m = (l+r)/2;

  dat[lev][m] = arr[m];
  for(int i=m-1; i>=l; i--){
    dat[lev][i] = Secret(arr[i], dat[lev][i+1]);
  }

  dat[lev][m+1] = arr[m+1];
  mask[m+1] ^= lev;
  for(int i=m+2; i<=r; i++){
    dat[lev][i] = Secret(dat[lev][i-1], arr[i]);
    mask[i]^=lev;
  }
  divi(l, m, lev+1);
  divi(m+1, r, lev+1);
}

void Init(int N, int A[]) {
  n = N;
  for(int i=0; i<n; i++){
    arr[i] = A[i];
    mask[i] = 0;
  }

  divi(0, n-1, 0);
}

int Query(int L, int R) {
  if(L==R) return arr[L];
  int levi = __builtin_ctz(mask[L] ^ mask[R]);
  return Secret(dat[levi][L], dat[levi][R]);
}

Compilation message

/usr/bin/ld: /tmp/cc5jTnCW.o: in function `main':
grader-full.cpp:(.text.startup+0x2a8): undefined reference to `Init(int, int*)'
/usr/bin/ld: grader-full.cpp:(.text.startup+0x30b): undefined reference to `Query(int, int)'
collect2: error: ld returned 1 exit status