Submission #1118595

#TimeUsernameProblemLanguageResultExecution timeMemory
1118595peraSpeedrun (RMI21_speedrun)C++17
0 / 100
329 ms1196 KiB
#include<bits/stdc++.h> #include "speedrun.h" using namespace std;/* int v; vector<int> val(100); vector<vector<int>> G(100); void setHintLen(int x){ } void setHint(int u , int bit , int x){ val[u] += x * (1 << bit); } int getHint(int bit){ return val[v] >> bit & 1; } bool goTo(int u){ bool good = false; for(int V : G[v]){ if(V == u){ good = true; v = u; } } return good; }*/ void assignHints(int subtask , int N , int A[] , int B[]){ vector<vector<int>> g(N + 1); for(int i = 1;i <= N - 1;i ++){ g[A[i]].emplace_back(B[i]); g[B[i]].emplace_back(A[i]); } vector<int> par(N + 1) , o; function<void(int)> dfs = [&](int u){ o.emplace_back(u); for(int v : g[u]){ if(v != par[u]){ par[v] = u; dfs(v); } } }; dfs(1); setHintLen(20); for(int i = 1;i <= N;i ++){ for(int bit = 0;bit < 10;bit ++){ setHint(i , bit + 1, par[i] >> bit & 1); } for(int bit = 0;bit < 10;bit ++){ setHint(i , bit + 10 + 1 , o[i % N] >> bit & 1); } } } void speedrun(int subtask , int N , int v){ int c = 1; while(c < N){ int nxt = 0; for(int bit = 0;bit < 10;bit ++){ nxt += (1 << bit) * getHint(bit + 10 + 1); } while(goTo(nxt) == false){ int par = 0; for(int bit = 0;bit < 10;bit ++){ par += (1 << bit) * getHint(bit + 1); } goTo(par); } ++c; v = nxt; } return; }/* int main(){ int N; cin >> N >> v; int A[N] , B[N]; for(int i = 1;i < N;i ++){ int u , vx; cin >> u >> vx; G[u].emplace_back(vx); G[vx].emplace_back(u); A[i] = u , B[i] = vx; } assignHints(0 , N , A , B); speedrun(0 , N , v); }*/
#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...