제출 #1318018

#제출 시각아이디문제언어결과실행 시간메모리
131801824ta_tdanhSecret (JOI14_secret)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "secret.h" #define endl '\n' #define fi first #define se second #define eb emplace_back #define pb push_back #define ce cout << endl #define ALL(A) A.begin(), A.end() #define FOR(i, l, r) for (int i = l; i <= r; i++) #define FOR2(i, l, r) for (int i = l; i >= r; i--) using namespace std; using ll = long long; using pll = pair<ll, ll>; using pii = pair<int, int>; using str = string; using ull = unsigned long long; using ld = long double; const int INF = 1e9; const int N = 1000; const int LOGN = ceil(log2(N)); const int heavy = 500; const int MOD = 1e9 + 7; int dx[] = {0, 1, 0, -1}; // east, south, west, north int dy[] = {1, 0, -1, 0}; // T_Danh - Tri An High School int X[MAXN]; int dat[LOGN][MAXN]; int mask[MAXN]; void divi(int l, int r, int lev) { if (l == r) return; int m = (l + r) >> 1; dat[lev][m] = X[m]; FOR2(i,m - 1 , l) { dat[lev][i] = Secret(X[i], dat[lev][i + 1]); } dat[lev][m + 1] = X[m + 1]; FOR(i,m + 2 , r) { dat[lev][i] = Secret(dat[lev][i - 1], X[i]); } FOR(i,m + 1 , r) mask[i] ^= (1 << lev); divi(l, m, lev + 1); divi(m + 1, r, lev + 1); } void Init(int N, int A[]) { FOR(i,0,N -1) X[i] = A[i]; divi(0, N - 1, 0); } int Query(int L, int R) { if (L == R) return X[L]; int lev = __builtin_ctz(mask[L] ^ mask[R]); return Secret(dat[lev][L], dat[lev][R]); } // int main() { // ios::sync_with_stdio(0); // cin.tie(0); cout.tie(0); // int t = 1; // while (t--) solve(); // return 0; // }

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

secret.cpp:27:7: error: 'MAXN' was not declared in this scope
   27 | int X[MAXN];
      |       ^~~~
secret.cpp:28:15: error: 'MAXN' was not declared in this scope
   28 | int dat[LOGN][MAXN];
      |               ^~~~
secret.cpp:29:10: error: 'MAXN' was not declared in this scope
   29 | int mask[MAXN];
      |          ^~~~
secret.cpp: In function 'void divi(int, int, int)':
secret.cpp:36:5: error: 'dat' was not declared in this scope
   36 |     dat[lev][m] = X[m];
      |     ^~~
secret.cpp:36:19: error: 'X' was not declared in this scope
   36 |     dat[lev][m] = X[m];
      |                   ^
secret.cpp:46:22: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
   46 |     FOR(i,m + 1 , r) mask[i] ^= (1 << lev);
      |                      ^~~~
      |                      std::filesystem::perms::mask
In file included from /usr/include/c++/13/filesystem:48,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:200,
                 from secret.cpp:1:
/usr/include/c++/13/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::mask' declared here
  158 |       mask              = 07777,
      |       ^~~~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:53:19: error: 'X' was not declared in this scope
   53 |     FOR(i,0,N -1) X[i] = A[i];
      |                   ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:58:24: error: 'X' was not declared in this scope
   58 |     if (L == R) return X[L];
      |                        ^
secret.cpp:59:29: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
   59 |     int lev = __builtin_ctz(mask[L] ^ mask[R]);
      |                             ^~~~
      |                             std::filesystem::perms::mask
/usr/include/c++/13/bits/fs_fwd.h:158:7: note: 'std::filesystem::perms::mask' declared here
  158 |       mask              = 07777,
      |       ^~~~
secret.cpp:60:19: error: 'dat' was not declared in this scope
   60 |     return Secret(dat[lev][L], dat[lev][R]);
      |                   ^~~