제출 #1315005

#제출 시각아이디문제언어결과실행 시간메모리
1315005PlayVoltz가장 긴 여행 (IOI23_longesttrip)C++20
15 / 100
4 ms408 KiB
#include "longesttrip.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define fi first
#define se second

vector<int> longest_trip(int n, int d){
	if (d==3){
		vector<int> ans;
		for (int i=0; i<n; ++i)ans.pb(i);
		return ans;
	}
	else if (d==2){
		deque<int> ans(1, 0);
		int done=1;
		if (are_connected({0}, {1}))ans.pb(1);
		else ans.pb(2), done=2;
		for (int i=1; i<n; ++i)if (i!=done){
			if (are_connected({i}, {ans.back()}))ans.pb(i);
			else ans.push_front(i);
		}
		vector<int> res;
		for (auto a:ans)res.pb(a);
		return res;
	}
	
}

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...