Submission #1034333

# Submission time Handle Problem Language Result Execution time Memory
1034333 2024-07-25T12:27:29 Z andrei_c1 Speedrun (RMI21_speedrun) C++17
0 / 100
1 ms 344 KB
#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;

void assignHints(int subtask, int n, int a[], int b[]) { /* your solution here */
	vector<int> ord, up(n + 1);
	vector<vector<int>> adj(n + 1);
	for(int i = 1; i < n; i++) {
		adj[a[i]].emplace_back(b[i]);
		adj[a[i]].emplace_back(b[i]);
	}
	auto dfs = [&](auto &&self, int u) -> void {
		ord.emplace_back(u);
		for(const auto &it: adj[u]) if(it != up[u]) {
			up[it] = u;
			self(self, it);
		}
	};
	dfs(dfs, 1);
	setHintLen(20);
	auto setHintUp = [&](int u, int val) -> void {
		for(int i = 0; i < 10; i++) {
			setHint(u, i, val >> i & 1);
		}
	};
	auto setHintNext = [&](int u, int val) -> void {
		for(int i = 0; i < 10; i++) {
			setHint(u, i + 10, val >> i & 1);
		}
	};
	for(int i = 1; i <= n; i++) {
		setHintUp(i, up[i]);
		setHintNext(ord[i - 1], ord[i % n]);
	}
}

void speedrun(int subtask, int n, int u) { /* your solution here */
	auto getHintUp = [&]() -> int {
		int res = 0;
		for(int i = 0; i < 10; i++) {
			res |= getHint(i) << i;
		}
		return res;
	};
	auto getHintNext = [&]() -> int {
		int res = 0;
		for(int i = 0; i < 10; i++) {
			res |= getHint(i + 10) << i;
		}
		return res;
	};
	while(u != 1) {
		u = getHintUp();
		goTo(u);
	}
	do {
		int nxt = getHintNext();
		while(!goTo(nxt)) {
			u = getHintUp();
			goTo(u);
		}
		u = nxt;
	} while(u != 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Invalid bit index for setHint
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Invalid bit index for setHint
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Invalid bit index for setHint
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Invalid bit index for setHint
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Invalid bit index for setHint
2 Halted 0 ms 0 KB -