답안 #674779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674779 2022-12-26T07:48:35 Z Valera_Grinenko 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#include <vector>
using namespace std;

template<class T> struct offlineDQ {
  static const int SZ = (1 << 10);
  int n;
  T stor[SZ][32-__builtin_clz(SZ)];
	vector<T> a;
	void fill(int l, int r, int ind) {
		if (ind < 0) return;
		int m = (l+r)/2;
    for(int i = m - 1; i >= l; i--) stor[i][ind] = Secret(i, m - 1);
    for(int i = m; i < r; i++) stor[i][ind] = Secret(m, i);
		fill(l,m,ind-1); fill(m,r,ind-1);
	}
	void init() {
		n = 1; while ((1<<n) < (int)a.size()) ++n;
		a.resize(1<<n);
    fill(0,(1<<n),n-1);
	}
	T query(int l, int r) {
		if (l == r) return a[l];
		int t = 31-__builtin_clz(r^l);
		return comb(stor[l][t],stor[r][t]);
	}
};

offlineDQ<int> odq;

void Init(int N, int A[]) {
  odq.a.resize(N);
  for(int i = 0; i < N; i++) odq.a[i] = A[i];
  odq.init();
}

int Query(int L, int R) {
  return odq.query(--L, --R);
}

Compilation message

secret.cpp: In instantiation of 'T offlineDQ<T>::query(int, int) [with T = int]':
secret.cpp:38:28:   required from here
secret.cpp:25:14: error: 'comb' was not declared in this scope
   25 |   return comb(stor[l][t],stor[r][t]);
      |          ~~~~^~~~~~~~~~~~~~~~~~~~~~~