Submission #996035

# Submission time Handle Problem Language Result Execution time Memory
996035 2024-06-10T07:30:19 Z TAhmed33 Speedrun (RMI21_speedrun) C++17
0 / 100
57 ms 940 KB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
const int MAXN = 2e3 + 25;
const int B = 10;
vector <int> adj[MAXN];
vector <int> dd;
void dfs (int pos, int par) {
	dd.push_back(pos);
	for (int i = 0; i < B; i++) {
		if (par & (1 << i)) {
			setHint(pos, i + 1, 1);
		}
	}
	for (auto j : adj[pos]) {
		if (j == par) continue;
		dfs(j, pos);
	}
}
void assignHints (int s, int n, int a[], int b[]) {
	for (int i = 1; i < n; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	setHintLen(20);
	dfs(1, 0);
	for (int i = 0; i + 1 < n; i++) {
		for (int j = 0; j < B; j++) {
			if (dd[i + 1] & (1 << j)) {
				setHint(dd[i], B + j + 1, 1);
			}
		}
	}
}
void speedrun (int subtask, int n, int x) {
	while (x != 1) {
		int s = 0;
		for (int i = 0; i < B; i++) {
			s += (1 << i) * getHint(i + 1);
		}
		goTo(s);
	}
	int y = n - 1;
	while (y--) {
		int s = 0;
		for (int i = 0; i < B; i++) {
			s += (1 << i) * getHint(B + i + 1);
		}
		if (!goTo(s)) {
			s = 0;
			for (int i = 0; i < B; i++) {
				s += (1 << i) * getHint(i + 1);
			}
			goTo(s);
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 684 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 680 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 924 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 692 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 940 KB Invalid node index to goTo
2 Halted 0 ms 0 KB -