제출 #996042

#제출 시각아이디문제언어결과실행 시간메모리
996042TAhmed33Speedrun (RMI21_speedrun)C++17
0 / 100
60 ms968 KiB
#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); } while (!goTo(s)) { s = 0; for (int i = 0; i < B; i++) { s += (1 << i) * getHint(i + 1); } goTo(s); } } }
#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...