답안 #887105

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887105 2023-12-13T19:18:09 Z Username_taken12 가장 긴 여행 (IOI23_longesttrip) C++17
컴파일 오류
0 ms 0 KB
#include "longesttrip.h"

#include <bits/stdc++.h>
using namespace std;

vector<int> longest_trip(int N, int D){
vector<int> out;
for(int i=0; i<N; i++)
out.push_back(0);
if(D==3){

for(int i=0; i<N; i++)
out[i]=i+1;
return out;
}
if(D==2){

int pnt=1;
out[0]=1;
while(pnt<N){
vector<int> a;
a.push_back(pnt);
vector<int> b;
b.push_back(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){

return out;
}
return out;
}
}
return out;
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:26:16: warning: the address of 'bool are_connected(std::vector<int>, std::vector<int>)' will never be NULL [-Waddress]
   26 | bool connect = are_connected{a,b};
      |                ^~~~~~~~~~~~~
longesttrip.cpp:26:29: error: expected ',' or ';' before '{' token
   26 | bool connect = are_connected{a,b};
      |                             ^
longesttrip.cpp: At global scope:
longesttrip.cpp:45:1: error: expected declaration before '}' token
   45 | }
      | ^
longesttrip.cpp:46:1: error: expected unqualified-id before 'return'
   46 | return out;
      | ^~~~~~
longesttrip.cpp:47:1: error: expected declaration before '}' token
   47 | }
      | ^