제출 #871540

#제출 시각아이디문제언어결과실행 시간메모리
871540TAhmed33Speedrun (RMI21_speedrun)C++17
21 / 100
25 ms2544 KiB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void assignHints (int subtask, int n, int a[], int b[]) {
	setHintLen(n);
	bool adj[n + 1][n + 1]; memset(adj, 0, sizeof(adj));
	for (int i = 1; i < n; i++) {
		adj[a[i]][b[i]] = adj[b[i]][a[i]] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (adj[i][j]) setHint(i, j, adj[i][j]);
		}
	}
	return;
}
int n;
void dfs (int pos, int par) {
	for (int j = 1; j <= n; j++) {
		if (j == par || pos == j) continue;
        if (getHint(j) == 1) {
            goTo(j); dfs(j, pos); goTo(pos);
        }
	}
}
void speedrun (int subtask, int N, int start) {
	n = N;
	dfs(start, -1);
	return;
}
#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...