Submission #927341

#TimeUsernameProblemLanguageResultExecution timeMemory
927341TAhmed33즐거운 행로 (APIO20_fun)C++17
26 / 100
14 ms1448 KiB
#include <bits/stdc++.h>
#include "fun.h"
using namespace std;
int adj[501][501]; bool vis[501];
vector <int> ret;
int n;
vector <int> createFunTour (int N, int q) {
	n = N;
	int prev = 0;
	for (int i = 0; i < n; i++) {
		vector <int> o;
		for (int j = 0; j < n; j++) {
			if (!vis[j]) {
				adj[prev][j] = hoursRequired(prev, j);
				o.push_back(j);
			}
		}
		sort(o.begin(), o.end(), [&] (int x, int y) {
			return adj[prev][x] > adj[prev][y];
		});
		ret.push_back(o.front()); prev = o.front(); vis[prev] = 1;
		//cout << prev << '\n';
	}
	//reverse(ret.begin(), ret.end());
	return ret;
}
#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...