# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
645297 | 2022-09-26T16:30:59 Z | Vanilla | Speedrun (RMI21_speedrun) | C++17 | 217 ms | 820 KB |
#include <bits/stdc++.h> #include "speedrun.h" using namespace std;const int maxn = 1e3 + 2;void assignHints(int subtask, int N, int A[], int B[]) {vector <int> ad [maxn];setHintLen(20);for (int i = 1; i < N; i++){ad[A[i]].push_back(B[i]);ad[B[i]].push_back(A[i]);}vector <int> euler;int l[maxn] = {}, r [maxn] = {}, pr[maxn] = {};auto d = [&] (int i, int p, auto&& d) -> void {euler.push_back(i);pr[i] = p;for (int j: ad[i]) {if (j == p) continue;d(j, i, d);}};d(1, -1, d);for (int i = 0; i < N; i++){r[euler[i]] = euler[(i + 1) % N];}for (int i = 1; i <= N; i++){for (int b = 0; b <= 9; b++){setHint(i, b + 1, (pr[i] & (1 << b)));setHint(i, b + 11, (r[i] & (1 << b)));}}}void speedrun(int subtask, int N, int s) {int vis [maxn] = {};while (!vis[s]) {vis[s] = 1;int l = 0, r = 0;for (int i = 0; i <= 9; i++){l+=((1 << i) * getHint(i + 1));r+=((1 << i) * getHint(i + 11));}while (!goTo(r)) {goTo(l);s = l;l = 0;for (int i=0;i<= 9;i++){l+=((1<<i)*getHint(i+1));}}s=r;}}
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 185 ms | 672 KB | Output is correct |
2 | Correct | 210 ms | 708 KB | Output is correct |
3 | Correct | 216 ms | 736 KB | Output is correct |
4 | Correct | 197 ms | 812 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 176 ms | 704 KB | Output is correct |
2 | Correct | 201 ms | 804 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 199 ms | 672 KB | Output is correct |
2 | Correct | 200 ms | 700 KB | Output is correct |
3 | Correct | 187 ms | 688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 140 ms | 720 KB | Output is correct |
2 | Correct | 169 ms | 672 KB | Output is correct |
3 | Correct | 191 ms | 676 KB | Output is correct |
4 | Correct | 135 ms | 720 KB | Output is correct |
5 | Correct | 189 ms | 684 KB | Output is correct |
6 | Correct | 154 ms | 820 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 213 ms | 688 KB | Output is correct |
2 | Correct | 217 ms | 672 KB | Output is correct |
3 | Correct | 189 ms | 736 KB | Output is correct |
4 | Correct | 194 ms | 700 KB | Output is correct |
5 | Correct | 149 ms | 692 KB | Output is correct |
6 | Correct | 213 ms | 680 KB | Output is correct |
7 | Correct | 120 ms | 684 KB | Output is correct |