Submission #1201698

#TimeUsernameProblemLanguageResultExecution timeMemory
1201698A_M_NamdarFun Tour (APIO20_fun)C++20
26 / 100
52 ms13756 KiB
#include "fun.h" #include <bits/stdc++.h> using namespace std; const int N = 550; int d[N][N]; bool mark[N]; /* int hoursRequired(int u, int v) { int tmp[N]; memset(tmp, 63, sizeof tmp); vector<int> adj[N]; adj[0] = {1, 5, 6}; adj[1] = {0, 2, 4}; adj[2] = {1, 3}; adj[3] = {2}; adj[4] = {1}; adj[5] = {0}; adj[6] = {0}; tmp[u] = 0; queue<int> q; q.push(u); while (!q.empty()) { int x = q.front(); q.pop(); for (int y: adj[x]) if (tmp[y] > tmp[x] + 1) { tmp[y] = tmp[x] + 1; q.push(y); } } return tmp[v]; }*/ vector<int> createFunTour(int n, int q) { for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) d[i][j] = hoursRequired(i, j); vector<int> vec; int tmp = 0, qq = n; while (qq--) { int mx = -1; for (int i = 0; i < n; i++) if (!mark[i]) if(mx == -1 || d[tmp][i] > d[tmp][mx]) mx = i; tmp = mx; vec.push_back(tmp); mark[tmp] = true; } return vec; }
#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...