답안 #841734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841734 2023-09-02T01:39:54 Z anhduc2701 가장 긴 여행 (IOI23_longesttrip) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "longesttrip.h"
#define pb push_back
#define fi first
#define se second 
using namespace std;
typedef long long ll;
int n;
vector<int> longest_trip(int N,int D){
	n=N;
	if(D==3){
		vector<int>K;
		for(int i=0;i<N;i++){
			K.pb(i);
		}
		return K;
	}
	else if(D==2){
		vector<int>K;
		if(are_connected(vector<int>(1,0),vector<int>(1,1))){
			K.pb(0);
			K.pb(1);
		}
		else{
			K.pb(0);
			K.pb(2);
			K.pb(1);
		}
		while(K.size()<N){
			if(are_connected(vector<int>(1,K[0]),vector<int>(1,i))){
				K.insert(K.begin(),i);
			}
			else{
				K.pb(i);
			}
		}
		return K;
	}
}

Compilation message

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:29:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |   while(K.size()<N){
      |         ~~~~~~~~^~
longesttrip.cpp:30:55: error: 'i' was not declared in this scope
   30 |    if(are_connected(vector<int>(1,K[0]),vector<int>(1,i))){
      |                                                       ^
longesttrip.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^