# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598680 | kingfran1907 | Speedrun (RMI21_speedrun) | C++14 | 280 ms | 972 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
vector< int > graph[maxn];
vector< int > sol;
bool bio[maxn];
int parr[maxn];
void dfs(int x, int parr) {
sol.push_back(x);
::parr[x] = parr;
for (int tren : graph[x]) {
if (tren != parr) dfs(tren, x);
}
}
void assignHints(int subtask, int N, int A[], int B[]) {
for (int i = 1; i < N; i++) {
graph[A[i]].push_back(B[i]);
graph[B[i]].push_back(A[i]);
}
dfs(1, 0);
setHintLen(20);
for (int i = 0; i < sol.size(); i++) {
int tren = sol[i];
int r = sol[(i + 1) % sol.size()];
int par = parr[tren];
for (int i = 0; i < 10; i++)
setHint(tren, i + 1, r & (1 << i));
for (int i = 0; i < 10; i++)
setHint(tren, i + 11, par & (1 << i));
}
}
void speedrun(int subtask, int N, int start) {
memset(bio, false, sizeof bio);
bio[start] = true;
for (int t = 1; t < N; t++) {
int nex = 0;
for (int i = 0; i < 10; i++)
nex |= getHint(i + 1) << i;
while (!goTo(nex)) {
int parr = 0;
for (int i = 0; i < 10; i++)
parr |= (getHint(i + 11) << i);
assert(goTo(parr));
start = parr;
}
start = nex;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |