답안 #256222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
256222 2020-08-02T11:37:23 Z islingr 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b); i-- > (a); )

const int N = 1 << 10;
vector<int> L[N << 1], R[N << 1], a;
int n;

void build(int v, int l, int r) {
  if (r - l == 1) return;
  int m = (l + r) >> 1;
  L[v] = {a[m - 1]};
  per(i, l, m - 1) L[v].push_back(Secret(a[i], L[v].back()));
  reverse(begin(L[v]), end(L[v]));
  R[v] = {a[m]};
  rep(i, m + 1, r) R[v].push_back(Secret(R[v].back(), a[i]));
  build(v << 1|0, l, m); build(v << 1|1, m, r);
}

void Init(int N, int A[]) {
  n = N; a.resize(n); rep(i, 0, n) a[i] = A[i];
  build(1, 0, n);
}

int lo, hi;
int query(int v, int l, int r) {
  if (r - l == 1) return a[l];
  int m = (l + r) >> 1;
  assert(l <= lo && hi <= r);
  if (hi <= m) return query(v << 1|0, l, m);
  if (m <= lo) return query(v << 1|1, m, r);
  return Secret(L[v][lo - l], R[v][hi - m - 1]);
}

int Query(int L, int R) {
  lo = L; hi = R + 1;
  return query(1, 0, n);
}

Compilation message

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:15:35: error: 'Secret' was not declared in this scope
   per(i, l, m - 1) L[v].push_back(Secret(a[i], L[v].back()));
                                   ^~~~~~
secret.cpp:15:35: note: suggested alternative: 'qecvt'
   per(i, l, m - 1) L[v].push_back(Secret(a[i], L[v].back()));
                                   ^~~~~~
                                   qecvt
secret.cpp:18:35: error: 'Secret' was not declared in this scope
   rep(i, m + 1, r) R[v].push_back(Secret(R[v].back(), a[i]));
                                   ^~~~~~
secret.cpp:18:35: note: suggested alternative: 'qecvt'
   rep(i, m + 1, r) R[v].push_back(Secret(R[v].back(), a[i]));
                                   ^~~~~~
                                   qecvt
secret.cpp: In function 'int query(int, int, int)':
secret.cpp:34:10: error: 'Secret' was not declared in this scope
   return Secret(L[v][lo - l], R[v][hi - m - 1]);
          ^~~~~~
secret.cpp:34:10: note: suggested alternative: 'qecvt'
   return Secret(L[v][lo - l], R[v][hi - m - 1]);
          ^~~~~~
          qecvt