제출 #1261445

#제출 시각아이디문제언어결과실행 시간메모리
1261445thecyb비밀 (JOI14_secret)C++17
컴파일 에러
0 ms0 KiB
/*
    ==                     ==
                 <^\()/^>               <^\()/^>
                  \/  \/                 \/  \/
                   /__\      .  '  .      /__\
      ==            /\    .     |     .    /\            ==
   <^\()/^>       !_\/       '  |  '       \/_!       <^\()/^>
    \/  \/     !_/I_||  .  '   \'/   '  .  ||_I\_!     \/  \/
     /__\     /I_/| ||      -==C++==-      || |\_I\     /__\
     /_ \   !//|  | ||  '  .   /.\   .  '  || |  |\\!   /_ \
    (-   ) /I/ |  | ||       .  |  .       || |  | \I\ (=   )
     \__/!//|  |  | ||    '     |     '    || |  |  |\\!\__/
     /  \I/ |  |  | ||       '  .  '    *  || |  |  | \I/  \
    {_ __}  |  |  | ||                     || |  |  |  {____}
 _!__|= ||  |  |  | ||   *      +          || |  |  |  ||  |__!_
 _I__|  ||__|__|__|_||          A          ||_|__|__|__||- |__I_
 -|--|- ||--|--|--|-||       __/_\__  *    ||-|--|--|--||= |--|-
  |  |  ||  |  |  | ||      /\-'o'-/\      || |  |  |  ||  |  |
  |  |= ||  |  |  | ||     _||:<_>:||_     || |  |  |  ||= |  |
  |  |- ||  |  |  | || *  /\_/=====\_/\  * || |  |  |  ||= |  |
  |  |- ||  |  |  | ||  __|:_:_[I]_:_:|__  || |  |  |  ||- |  |
 _|__|  ||__|__|__|_||:::::::::::::::::::::||_|__|__|__||  |__|_
 -|--|= ||--|--|--|-||:::::::::::::::::::::||-|--|--|--||- |--|-
  jgs|- ||  |  |  | ||:::::::::::::::::::::|| |  |  |  ||= |  |
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^~~~~~~~~~
*/
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second

int dnc[11][1024], mask[1024];
int arr[1024];

void divide_conquer(const int &lvl, const int &l, const int &r, int a[]) {
  if (l == r) return;
  int m = (l + r) >> 1;
  dnc[lvl][m] = a[m];
  dnc[lvl][m+1] = a[m+1];
  for (int i = m-1; i >= 0; i--) dnc[lvl][i] = Secret(a[i], dnc[lvl][i+1]);
  for (int i = m+2; i < r; i++) dnc[lvl][i] = Secret(a[i], dnc[lvl][i-1]);
  for (int i = m+1; i < r; i++) mask[i] ^= 1<<lvl;
  divide_conquer(lvl+1, l, m, a);
  divide_conquer(lvl+1, m+1, r, a);
}

void init(int n, int a[]) {
  memset(dnc, 0, sizeof dnc);
  memcpy(arr, a, sizeof arr);
  divide_conquer(0, 0, n-1, a);
}

int Query(int l, int r) {
  if (l == r) return arr[l];
  int lvl = __builtin_ctz(mask[l] ^ mask[r]);
  return Secret(dnc[lvl][l], dnc[lvl][r]);
}

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

secret.cpp: In function 'void divide_conquer(const int&, const int&, const int&, int*)':
secret.cpp:41:48: error: 'Secret' was not declared in this scope
   41 |   for (int i = m-1; i >= 0; i--) dnc[lvl][i] = Secret(a[i], dnc[lvl][i+1]);
      |                                                ^~~~~~
secret.cpp:42:47: error: 'Secret' was not declared in this scope
   42 |   for (int i = m+2; i < r; i++) dnc[lvl][i] = Secret(a[i], dnc[lvl][i-1]);
      |                                               ^~~~~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:57:10: error: 'Secret' was not declared in this scope
   57 |   return Secret(dnc[lvl][l], dnc[lvl][r]);
      |          ^~~~~~