Submission #737116

#TimeUsernameProblemLanguageResultExecution timeMemory
737116mjhmjh1104Speedrun (RMI21_speedrun)C++17
19 / 100
175 ms920 KiB
#include "speedrun.h" #include <vector> using namespace std; int n; vector<int> adj[1006]; void assign(int x, int y, int z) { for (int i = 0; i < 10; i++) setHint(x + 1, y * 10 + i + 1, z & 1 << i ? true : false); } int get(int y) { int ret = 0; for (int i = 0; i < 10; i++) ret |= getHint(y * 10 + i + 1) << i; return ret; } void assignHints(int subtask, int n, int a[], int b[]) { ::n = n; for (int i = 1; i < n; i++) { adj[a[i] - 1].push_back(b[i] - 1); adj[b[i] - 1].push_back(a[i] - 1); } setHintLen(20); for (int i = 0; i < n; i++) for (int j = 0; j < 2; j++) { if (j < (int)adj[i].size()) assign(i, j, adj[i][j]); else assign(i, j, 1023); } } void dfs(int x, int prev = -1) { for (int i = 0; i < 2; i++) if (get(i) != 1023) adj[x].push_back(get(i)); for (auto &i: adj[x]) if (i != prev) { goTo(i + 1); dfs(i, x); } if (prev != -1) goTo(prev + 1); } void speedrun(int subtask, int n, int st) { ::n = n; dfs(st - 1); }
#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...