답안 #979953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
979953 2024-05-11T17:24:44 Z vjudge1 가장 긴 여행 (IOI23_longesttrip) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int[] longest_trip(int N, int D){
	int r[N],j=0;
	r[0]=0;
	for(int i=1;i<N;i++){
		int e1[1]={r[j]},e2[1]={i};
		if(are_connected(e1,e2))j++,r[j]=i;
		else if(i==N-1){
			for(int k=N-1;0<k;k--)r[k]=r[k-1];
			r[0]=i;
		}
		else j++,r[j]=i+1,j++,r[j]=i,i++;
	}
	return r;
}

Compilation message

longesttrip.cpp:4:4: error: structured binding declaration cannot have type 'int'
    4 | int[] longest_trip(int N, int D){
      |    ^~
longesttrip.cpp:4:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
longesttrip.cpp:4:4: error: empty structured binding declaration
longesttrip.cpp:4:7: error: expected initializer before 'longest_trip'
    4 | int[] longest_trip(int N, int D){
      |       ^~~~~~~~~~~~