Submission #500891

#TimeUsernameProblemLanguageResultExecution timeMemory
500891mosiashvililukaSpeedrun (RMI21_speedrun)C++14
0 / 100
1 ms584 KiB
#include<bits/stdc++.h> #include "speedrun.h" using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,p[1009],pi,msh[1009]; vector <int> v[1009]; void dfs(int q, int w){ pi++;p[pi]=q;msh[q]=w; for(vector <int>::iterator it=v[q].begin(); it!=v[q].end(); it++){ if((*it)==w) continue; dfs((*it),q); } } void assignHints(int subtask, int NN, int AA[], int BB[]) { setHintLen(20); a=NN; for(i=1; i<=a; i++){ v[AA[i]].push_back(BB[i]); v[BB[i]].push_back(AA[i]); } dfs(1,0); for(i=1; i<=a; i++){ if(i<a){ c=p[i+1];d=0; while(c>0){ if(c%2==1) setHint(p[i],d,1); c/=2;d++; } } c=msh[p[i]];d=10; while(c>0){ if(c%2==1) setHint(p[i],d,1); c/=2;d++; } } } int MSH(int q){ int qw=0,we=1; for(int h=10; h<=19; h++){ if(getHint(h)) qw+=we; we*=2; } return qw; } int nxt(int q){ int qw=0,we=1; for(int h=0; h<=9; h++){ if(getHint(h)) qw+=we; we*=2; } return qw; } void dfs(int q){ int w=nxt(q); if(w==0) return; while(goTo(w)==0){ int qw=MSH(q); goTo(qw); q=qw; } dfs(w); } void speedrun(int subtask, int NN, int start) { a=NN;c=start; while(c!=1){ zx=MSH(c); goTo(zx); c=zx; } dfs(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...