제출 #887097

#제출 시각아이디문제언어결과실행 시간메모리
887097Username_taken12가장 긴 여행 (IOI23_longesttrip)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; 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; } }

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

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