Submission #871544

# Submission time Handle Problem Language Result Execution time Memory
871544 2023-11-11T05:20:56 Z TAhmed33 Speedrun (RMI21_speedrun) C++17
8 / 100
13 ms 1792 KB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
void assignHints (int subtask, int n, int a[], int b[]) {
	int deg[n + 1] = {};
	if (n == 1) return;
	for (int i = 1; i < n; i++) {
		deg[a[i]]++;
		deg[b[i]]++;
	}
	int pos = 1;
	for (int i = 1; i <= n; i++) {
		if (deg[i] > 1) {
			pos = i;
		}
	}
	setHintLen(1);
	setHint(pos, 1, 1);
}
void speedrun (int subtask, int n, int start) {
	if (n == 1) return;
	int x = getHint(1);
	if (x == 1) {
		for (int i = 1; i <= n; i++) {
			if (i == start) continue;
			goTo(i); goTo(start);
		}
		return;
	}
	for (int i = 1; i <= n; i++) {
		if (i == start) continue;
		if (goTo(i)) {
			for (int j = 1; j <= n; j++) {
				if (j == i || j == start) continue;
				goTo(j); goTo(i);
			}
			goTo(start);
			return;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 768 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 1276 KB Output is correct
2 Correct 10 ms 1792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 768 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 928 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 768 KB Used too many wrong interactions
2 Halted 0 ms 0 KB -