Submission #642518

#TimeUsernameProblemLanguageResultExecution timeMemory
642518Tenis0206Speedrun (RMI21_speedrun)C++14
0 / 100
367 ms756 KiB
#include <bits/stdc++.h> #include "speedrun.h" using namespace std; int l[1005],t[1005]; vector<int> G[1005]; int poz = 0; void dfs(int nod, int dad = 0) { l[++poz] = nod; for(auto it : G[nod]) { if(it==dad) { continue; } t[it] = nod; dfs(it,nod); } } void setDad(int nod, int dad) { for(int b=0;b<10;b++) { bool val = ((dad & (1<<b)) != 0); setHint(nod,b+1,val); } } void setNext(int nod, int next) { for(int b=0;b<10;b++) { bool val = ((next & (1<<b)) != 0); setHint(nod,b+11,val); } } void assignHints(int subtask, int n, int a[], int b[]) { setHintLen(20); for(int i=1;i<n;i++) { G[a[i]].push_back(b[i]); G[b[i]].push_back(a[i]); } dfs(1); for(int i=1;i<=n;i++) { setDad(l[i],t[i]); setNext(l[i],l[i+1]); } } int getDad(int nod) { int rez = 0; for(int b=0;b<10;b++) { int val = getHint(b + 1); rez += val * (1<<b); } return rez; } int getNext(int nod) { int rez = 0; for(int b=0;b<10;b++) { int val = getHint(b + 11); rez += val * (1<<b); } return rez; } void speedrun(int subtask, int n, int start) { getLength(); int nod = start; while(nod!=1) { int dad = getDad(nod); goTo(dad); nod = dad; } for(int i=1;i<n;i++) { int next = getNext(nod); bool ok = goTo(next); while(!ok) { int dad = getDad(nod); goTo(dad); nod = dad; ok = goTo(next); } nod = next; } }
#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...