답안 #984083

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
984083 2024-05-16T09:57:22 Z Izaz 순열 (APIO22_perm) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define mn(a,b) min(a,b)
#define mx(a,b) max(a,b)
#define ll long long

// 
int[] construct_permutation(int64 k);
{
	int K = k;
	vector<int>AL;
	for(int i = 0 ; i < 9;i ++ ){
		AL.push_back(i);
		vector<int>Z  = AL;
		int yes = 0;
		do{
			int N = AL.size();
			int Cnt = 1 ;
			for(int i = 1 ; i < (1<< N); i ++){
				bool P = 1;
				int last = - 1;
				for(int j = 0 ; j < N;j++){
					if((1<<j)&i){
						if(last > Z[j]){
							P =0;
							break;
						}
						last = Z[j];
					}
				}
				if(P)Cnt++;
			}
			
			if(Cnt == K){
				yes = 1;
				break;
			}
		
		}while(next_permutation(Z.begin(),Z.end()));
		if(yes){
			int arr[AL.size()];
			for(int i = 0 ; i < Z.size();i++){
				arr[i] = Z[i];
			}
			return arr;
		}
	}
	return {0};
}

Compilation message

perm.cpp:11:4: error: structured binding declaration cannot have type 'int'
   11 | int[] construct_permutation(int64 k);
      |    ^~
perm.cpp:11:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
perm.cpp:11:4: error: empty structured binding declaration
perm.cpp:11:7: error: expected initializer before 'construct_permutation'
   11 | int[] construct_permutation(int64 k);
      |       ^~~~~~~~~~~~~~~~~~~~~
perm.cpp:12:1: error: expected unqualified-id before '{' token
   12 | {
      | ^