# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526527 | beksultan04 | Fun Tour (APIO20_fun) | C++14 | 2082 ms | 2292 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "fun.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ret return
#define fr first
#define sc second
#define pb push_back
#define endi puts("");
#define NO puts("NO");
#define OK puts("OK");
using namespace std;
const int INF = 1e5+12;
bool asa,ll=0;
int dis[1001][1001],n,used[1001];
vector <int> ans;
void dfs(int x,int dl){
if (ll == 1)ret ;
if (ans.size() == n){
ll = 1;
ret ;
}
for (int i=0;i<n;++i){
if (x == i || used[i])continue;
if (!dis[x][i]){
dis[x][i] = hoursRequired(x,i);
dis[i][x] = dis[x][i];
}
if (dl >= dis[x][i]){
used[i] = 1;
ans.pb(i);
dfs(i,dis[x][i]);
if (ll == 1)ret ;
ans.pop_back();
used[i] = 0;
}
}
}
vector<int> createFunTour(int N, int Q) {
n = N;
dfs(0,INF);
ret ans;
}
Compilation message (stderr)
# | 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... |