Submission #979953

# Submission time Handle Problem Language Result Execution time Memory
979953 2024-05-11T17:24:44 Z vjudge1 Longest Trip (IOI23_longesttrip) C++17
Compilation error
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){
      |       ^~~~~~~~~~~~