이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "fun.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
#define sz(a) ((ll)(a).size())
using namespace std;
const ll maxn=100005;
ll check[maxn];
vector <ll> A[maxn];
vector<int> createFunTour(int n, int Q) 
{
    for (ll i=0; i<n; i++)
        for (ll j=i+1; j<n; j++)
            if (hoursRequired(i, j)==1)
                A[i].pb(j), A[j].pb(i);
    auto furthest=[&](ll r)
    {
        vector <ll> dis(n, -1);
        queue <ll> q; q.push(r), dis[r]=0;
        pll Max={0, 0};
        while (sz(q))
        {
            ll u=q.front(); q.pop();
            Max=max(Max, {dis[u], u});
            for (ll v:A[u])
                if (!check[v] && dis[v]==-1)
                    dis[v]=dis[u]+1, q.push(v);
        }
        return Max.se;
    };
    vector <ll> tour;
    ll cr=furthest(0); tour.pb(cr), check[cr]=1;
    for (ll i=1; i<n; i++)
        cr=furthest(cr), tour.pb(cr), check[cr]=1;
    return tour;
}
| # | 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... |