이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "longesttrip.h"
#include<bits/stdc++.h>
#include<random>
#define ll long long
#define F first
#define S second
#define in insert
#define pb push_back
#define ppb pop_back()
#define d3 ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define cans cout << ans << "\n";
#define yes cout << "Yes" << "\n";
#define no cout << "No" << "\n";
#define pll pair<ll,ll>
#define lin cout << "\n";
#define sqr 340
#define mod 1000000007
#define mid ((l+r)/2)
#define lc (2*n)
#define rc (2*n+1)
using namespace std;
std::vector<int> longest_trip(int N, int D)
{
ll n = N;
vector<int> trnbo;
trnbo.pb(0);
ll x = -1;
for(int i = 0 ; n-1>i ; i++)
{
if(are_connected({i},{i+1}))
trnbo.pb(i+1);
else
{
if(i==n-2)
x=i+1;
else if(i==n-3)
{
trnbo.pb(i+2);
trnbo.pb(i+1);
break;
}
else
{
trnbo.pb(i+2);
trnbo.pb(i+1);
trnbo.pb(i+3);
i+=2;
}
}
}
if(x!=-1)
trnbo.insert(trnbo.begin(),x);
return trnbo;
}
# | 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... |