# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737006 | 2023-05-06T12:55:11 Z | ibm2006 | Speedrun (RMI21_speedrun) | C++14 | 2 ms | 756 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 748 KB | Invalid node index to goTo |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 756 KB | Invalid node index to goTo |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 748 KB | Invalid node index to goTo |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 748 KB | Invalid node index to goTo |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 704 KB | Invalid node index to goTo |
2 | Halted | 0 ms | 0 KB | - |