Submission #887098

# Submission time Handle Problem Language Result Execution time Memory
887098 2023-12-13T19:06:54 Z Username_taken12 Longest Trip (IOI23_longesttrip) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

public int[] longest_trip(int N, int D){
	if(D==3){
		int out[N];
		for(int i=0; i<N; i++)
			out[i]=i+1;
		return out;
	}
	if(D==2){
		int out[N];
		int pnt=1;
		out[0]=1;
		while(pnt<N){
			int a [1] = {pnt};
			int b [1] = {pnt+1};
			bool connect = are_connected{a,b};
			if(connect){
				out[pnt]=pnt+1;
				pnt++;
			}
			else{
				out[pnt]=pnt+2;
				out[pnt+1]=pnt+1;
				pnt++; pnt++;
			}
		}
		return out;
	}
	if(D==1){
		int out[1]={1};
		return out;
	}
}

Compilation message

longesttrip.cpp:5:1: error: expected unqualified-id before 'public'
    5 | public int[] longest_trip(int N, int D){
      | ^~~~~~