제출 #1073794

#제출 시각아이디문제언어결과실행 시간메모리
10737944QT0RUnscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;

int odp[129];

void build(int l, int p, int n){
	if (l==p)return;
	string s;
	for (int i = 0; i<n; i++)s+='1';
	for (int i = l; i<=p; i++){
		s[i]='0';
	}
	int md=(l+p)/2;
	for (int i = l; i<=md; i++){
		s[i]='1';
		add_element(s);
		s[i]='0';
	}
	build(l,md,n);
	build(md+1,p,n);
}

void reconstruct(int l, int p, int n, vector<int> podz){
	if (l==p){
		odp[podz[0]]=l;
		return;
	}
	string s;
	for (int i = 0; i<n; i++)s+='1';
	for (auto u : podz)s[u]='0';
	vector<int> lewo,prawo;
	for (auto u : podz){
		s[u]='1';
		if (check_element(s))lewo.push_back(u);
		else prawo.push_back(u);
		s[u]='0';
	}
	reconstruct(l,(l+p)/2,n,lewo);
	reconstruct((l+p)/2+1,p,n,prawo);
}

int[] restore_permutation(int n, int w, int r){
	build(0,n-1,n);
	compile_set();
	vector<int> wszystko;
	for (int i = 0; i<n; i++)wszystko.push_back(i);
	reconstruct(0,n-1,n,wszystko);
	odpowiedz(odp);
}

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

messy.cpp:43:4: error: structured binding declaration cannot have type 'int'
   43 | int[] restore_permutation(int n, int w, int r){
      |    ^~
messy.cpp:43:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
messy.cpp:43:4: error: empty structured binding declaration
messy.cpp:43:7: error: expected initializer before 'restore_permutation'
   43 | int[] restore_permutation(int n, int w, int r){
      |       ^~~~~~~~~~~~~~~~~~~