# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078444 | vjudge1 | Longest Trip (IOI23_longesttrip) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "longesttrip.h"
#include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define vi vector<int>
#define ll long long
#define ff first
#define ss second
using namespace std;
const int MAX=3e3+5;
vector<int> longest_trip(int n,int d){
vector<int>a;
a.push_back(0);
vector<int>b;
b.push_back(1);
int x=0;
int y=0;
deque<int>ans;
if(are_connected(a,b)){
x=0;
y=1;
ans.push_back(0);
ans.push_back(1);
}
else{
x=0;
y=2;
ans.push_back(0);
ans.push_back(1);
ans.push_back(2);
}
for(int i=2;i<n;i++){
if(ans.size()==3 and i==2) continue;
if(are_connected(y,i)){
ans.push_back(i);
}
else{
ans.push_front(i);
}
}
vector<int>v;
for(auto it:ans){
v.push_back(it);
}
return v;
}