제출 #1358271

#제출 시각아이디문제언어결과실행 시간메모리
135827112345678가장 긴 여행 (IOI23_longesttrip)C++17
15 / 100
3 ms412 KiB
#include "longesttrip.h"
#include <bits/stdc++.h>

using namespace std;

std::vector<int> longest_trip(int N, int D)
{
    vector<int> d[2];
    d[0]={0}, d[1]={1};
    for (int i=2; i<N; i++)
    {
        if (are_connected(vector<int> {d[0].back()}, vector<int> {i})) d[0].push_back(i);
        else d[1].push_back(i);
    }
    if (are_connected(vector<int> {d[0].front()}, vector<int> {d[1].front()}))
    {
        reverse(d[0].begin(), d[0].end());
        for (auto x:d[1]) d[0].push_back(x);
        return d[0];
    }
    if (are_connected(vector<int> {d[0].front()}, vector<int> {d[1].back()}))
    {
        for (auto x:d[0]) d[1].push_back(x);
        return d[1];
    }
    if (are_connected(vector<int> {d[0].back()}, vector<int> {d[1].front()}))
    {
        for (auto x:d[1]) d[0].push_back(x);
        return d[0];
    }
    if (are_connected(vector<int> {d[0].back()}, vector<int> {d[1].back()}))
    {
        reverse(d[1].begin(), d[1].end());
        for (auto x:d[1]) d[0].push_back(x);
        return d[0];
    }
}

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:37:1: warning: control reaches end of non-void function [-Wreturn-type]
   37 | }
      | ^
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…