이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define MAX 500005
#define F first
#define S second 
std::vector<int> longest_trip(int N, int D);
bool are_connected(std::vector<int> A, std::vector<int> B);
ll pass[MAX];
std::vector<int> longest_trip(int N, int D)
{
    if(D==3){
        std::vector<int> r={};
        for(int i=0;i<N;i++)r.push_back(i);
        return r;
    }
    vi r={0};
    if(are_connected({0},{1})==0)r.push_back(2);
    r.push_back(1);vi fron={};
    for(int i=r.size();i<N;i++){
        if(are_connected({r.back()},{i})==0)fron.push_back(i);
        else                                    r.push_back(i);
    }
    reverse(fron.begin(),fron.end());
    for(auto u : r)fron.push_back(u);
    return fron;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |