Submission #736707

# Submission time Handle Problem Language Result Execution time Memory
736707 2023-05-06T06:48:26 Z flappybird Speedrun (RMI21_speedrun) C++17
100 / 100
292 ms 836 KB
#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
#define MAX 1010

namespace srun {
	int N;
	int ord[MAX];
	void mark(int v, int x, int bias) { for (int i = 0; i < 10; i++) setHint(v, i + bias, (x >> i) & 1); }
	int get(int bias) { int ans = 0; for (int i = 0; i < 10; i++) if (getHint(i + bias)) ans |= (1 << i); return ans; }
	vector<int> adj[MAX];
	int pv = 0;
	void dfs(int x, int p = 0) {
		if (pv) mark(pv, x, 1);
		pv = x;
		if (p) mark(x, p, 11);
		for (auto v : adj[x]) if (v != p) dfs(v, x);
	}
}

using namespace srun;

void assignHints(int subtask, int _N, int A[], int B[]) {
	setHintLen(20);
	N = _N;
	int i;
	for (i = 1; i < N; i++) {
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	dfs(1);
}

void speedrun(int subtask, int N, int start) {
	int v = start;
	while (1) {
		int res = get(11);
		if (res) goTo(v = res);
		else break;
	}
	vector<int> st(1, 1);
	while (1) {
		int nxt = get(1);
		if (!nxt) return;
		while (!goTo(nxt)) {
			st.pop_back();
			goTo(st.back());
		}
		st.push_back(nxt);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 175 ms 756 KB Output is correct
2 Correct 213 ms 796 KB Output is correct
3 Correct 208 ms 716 KB Output is correct
4 Correct 190 ms 720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 223 ms 672 KB Output is correct
2 Correct 206 ms 712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 213 ms 768 KB Output is correct
2 Correct 155 ms 784 KB Output is correct
3 Correct 218 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 172 ms 712 KB Output is correct
2 Correct 246 ms 728 KB Output is correct
3 Correct 241 ms 744 KB Output is correct
4 Correct 117 ms 776 KB Output is correct
5 Correct 244 ms 836 KB Output is correct
6 Correct 292 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 183 ms 708 KB Output is correct
2 Correct 177 ms 724 KB Output is correct
3 Correct 209 ms 720 KB Output is correct
4 Correct 260 ms 768 KB Output is correct
5 Correct 177 ms 732 KB Output is correct
6 Correct 202 ms 672 KB Output is correct
7 Correct 197 ms 712 KB Output is correct