# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
842486 | CodePlatina | Longest Trip (IOI23_longesttrip) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "longesttrip.h"
#include <iostream>
#include <algorithm>
#define pii pair<int, int>
#define ff first
#define ss second
using namespace std;
vector<int> longest_trip(int N, int d)
{
bool chc[N]{};
vector<pii> V;
for(int i = 0; i < N; ++i)
{
for(int j = i + 1; j < N; ++j)
{
if(!are_connected(vector<int>{i}, vector<int>{j}))
chc[i] = true, chc[j] = true, V.push_back({i, j});
}
}
vector<int> ret;
for(auto [x, y] : V) ret.push_back(x);
for(int i = 0; i < N; ++i) if(!chc[i]) ret.push_back(x);
for(auto [x, y] : V) ret.push_back(y);
return ret;
}