Submission #645296

#TimeUsernameProblemLanguageResultExecution timeMemory
645296VanillaSpeedrun (RMI21_speedrun)C++17
100 / 100
236 ms928 KiB
#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 dfs = [&] (int i, int p, auto&& dfs) -> void {euler.push_back(i);pr[i] = p;for (int j: ad[i]) {if (j == p) continue;dfs(j, i, dfs);}};dfs(1, -1, dfs);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 (stderr)

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:3:242: warning: unused variable 'l' [-Wunused-variable]
    3 | 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 dfs = [&] (int i, int p, auto&& dfs) -> void {euler.push_back(i);pr[i] = p;for (int j: ad[i]) {if (j == p) continue;dfs(j, i, dfs);}};dfs(1, -1, dfs);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;}}
      |                                                                                                                                                                                                                                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...