Submission #871554

# Submission time Handle Problem Language Result Execution time Memory
871554 2023-11-11T05:39:11 Z TAhmed33 Speedrun (RMI21_speedrun) C++17
19 / 100
123 ms 1468 KB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
vector <int> conv (int x) {
	vector <int> dd;
	for (int i = 9; i >= 0; i--) {
		dd.push_back((x >> i) & 1);
	}
	return dd;
}
void assignHints (int subtask, int n, int a[], int b[]) {
	vector <int> adj[n + 1];
	for (int i = 1; i < n; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	setHintLen(20);
	for (int i = 1; i <= n; i++) {
		auto d = conv(adj[i][0]);
		for (int l = 1; l <= 10; l++) {
			setHint(i, l, d[l - 1]);
		}
		if (adj[i].size() == 1) continue;
		d = conv(adj[i][1]);
		for (int l = 1; l <= 10; l++) {
			setHint(i, l + 10, d[l - 1]);
		}
	}
}
int n;
void dfs (int pos, int par) {
	int x = 0;
	for (int i = 1; i <= 10; i++) {
		x *= 2; x += getHint(i);
	}
	if (x != 0 && x != par) {
		goTo(x); dfs(x, pos); goTo(pos);
	}
	x = 0;
	for (int i = 11; i <= 20; i++) {
		x *= 2; x += getHint(i);
	}
	if (x != 0 && x != par) {
		goTo(x); dfs(x, pos); goTo(pos);
	}
}
void speedrun (int subtask, int N, int start) {
	dfs(start, -1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 65 ms 684 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 716 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 113 ms 940 KB Output is correct
2 Correct 123 ms 1468 KB Output is correct
3 Correct 114 ms 1456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 87 ms 684 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 67 ms 684 KB Solution didn't visit every node
2 Halted 0 ms 0 KB -