#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); x = 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);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
55 ms |
688 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
46 ms |
684 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
944 KB |
Output is correct |
2 |
Incorrect |
55 ms |
908 KB |
Solution didn't visit every node |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
49 ms |
944 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
57 ms |
908 KB |
Solution didn't visit every node |
2 |
Halted |
0 ms |
0 KB |
- |