Submission #737006

#TimeUsernameProblemLanguageResultExecution timeMemory
737006ibm2006Speedrun (RMI21_speedrun)C++14
0 / 100
2 ms756 KiB
#include<bits/stdc++.h> #include "speedrun.h" using namespace std; typedef int ll; ll c[1100],d[1100],z,h[1100]; vector<ll> v[1100]; void f(ll x,ll y) { ll i; c[x]=y; d[z]=x; z=x; for(i=0;i<h[x];i++) { if(v[x][i]==y) continue; f(v[x][i],x); } } void assignHints(ll subtask,ll N,ll A[],ll B[]) { ll i,n,x,j; n=i; for(i=1;i<=n;i++) {v[i].clear(); h[i]=0; } for(i=1;i<n;i++) { v[A[i]].push_back(B[i]); v[B[i]].push_back(A[i]); h[A[i]]++; h[B[i]]++; } f(1,0); setHintLen(20); for(i=1;i<=n;i++) { x=c[i]; for(j=1;j<=10;j++) { setHint(i,j,x%2); x/=2; } x=d[i]; for(j=11;j<=20;j++) { setHint(i,j,x%2); x/=2; } } } ll a[1100],b[1100]; ll g(ll x,ll y) { ll i,j,r,z,w; if(c[x]==0) { c[x]=1; w=0; r=1; for(i=1;i<=10;i++) { w=getHint(i); if(z==1) w+=r; r*=2; } b[x]=w; w=0; r=1; for(i=1;i<=10;i++) { z=getHint(i+10); if(z==1) w+=r; r*=2; } a[x]=w; } ll k=a[x]; while(1) { if(k==0) return 0; if(goTo(k)) { k=g(k,x); } else { goTo(y); return k; } } } void speedrun(ll subtask,ll N,ll start) { ll i,x,y,r=1,z; bool t; x=start; while(x!=1) { if(c[x]==0) { c[x]=1; y=0; r=1; for(i=1;i<=10;i++) { z=getHint(i); if(z==1) y+=r; r*=2; } b[x]=y; y=0; r=1; for(i=1;i<=10;i++) { z=getHint(i+10); if(z==1) y+=r; r*=2; } a[x]=y; } x=b[x]; t=goTo(x); } g(x,0); }

Compilation message (stderr)

speedrun.cpp: In function 'll g(ll, ll)':
speedrun.cpp:55:10: warning: unused variable 'j' [-Wunused-variable]
   55 |     ll i,j,r,z,w;
      |          ^
speedrun.cpp: In function 'void speedrun(ll, ll, ll)':
speedrun.cpp:100:10: warning: variable 't' set but not used [-Wunused-but-set-variable]
  100 |     bool t;
      |          ^
speedrun.cpp: In function 'void assignHints(ll, ll, ll*, ll*)':
speedrun.cpp:24:6: warning: 'i' is used uninitialized in this function [-Wuninitialized]
   24 |     n=i;
      |     ~^~
speedrun.cpp: In function 'll g(ll, ll)':
speedrun.cpp:65:17: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   65 |                 if(z==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...