Submission #1197472

#TimeUsernameProblemLanguageResultExecution timeMemory
1197472adiyerFun Tour (APIO20_fun)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> #include "fun.h" using namespace std; int a[1000][1000]; std::vector<int> createFunTour(int N, int Q) { int val = 0, st = 0; for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ a[i][j] = hoursRequired(i, j); if(a[i][j] >= val) st = i; } } vector < int > ans; int was[N] = {}, lst = st; was[lst] = 1, ans.push_back(lst); for(int i = 0; i < N - 1; i++){ int k = -1; for(int j = 0; j < N; j++){ if(!was[j]){ if((k == -1 || a[lst][j] >= a[lst][k]) && a[lst][j] <= val){ k = j; } } } val = a[lst][k]; was[k] = 1; ans.push_back(k); lst = k; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...