답안 #881102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881102 2023-11-30T15:14:25 Z smartmonky 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"

using namespace std;
 
int t[10][1001],msk[1001],b[1001];
 
void build(int x, int l, int r, int a[])
{
	if(l>=r)return;
	int mid=(l+r)/2;
	t[x][mid]=a[mid];
	for(int i=mid-1;i>=l;i--)
		t[x][i]=Secret(a[i],t[x][i+1]);
	
	t[x][mid+1]=a[mid+1];
	msk[mid+1]|=(1<<x);
	for(int i=mid+2;i<=r;i++)
	{
		t[x][i]=Secret(t[x][i-1],a[i]);
		msk[i]|=(1<<x);
	}
	build(x+1,l,mid,a);
	build(x+1,mid+1,r,a);
}
 
void Init(int n, int a[])
{
	for(int i=0;i<n;i++)b[i]=a[i];
	//build(0,0,n-1,a);
}
 
int Query(int l, int r)
{
	vector <int> prev, cur;
	for(int i =1 ; i <= r; i++)
		cur.pb(b[i]);
	
	while(cur.size() != 1){
		for(int i = 0; i + 1< n; i += 2){
			prev.pb(cur[i], cur[i + 1]);
		}
		cur = prev;
		prev.clear();
	}
	return cur[0];
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:37:7: error: 'class std::vector<int>' has no member named 'pb'
   37 |   cur.pb(b[i]);
      |       ^~
secret.cpp:40:25: error: 'n' was not declared in this scope
   40 |   for(int i = 0; i + 1< n; i += 2){
      |                         ^
secret.cpp:41:9: error: 'class std::vector<int>' has no member named 'pb'
   41 |    prev.pb(cur[i], cur[i + 1]);
      |         ^~