Submission #737005

# Submission time Handle Problem Language Result Execution time Memory
737005 2023-05-06T12:52:26 Z ibm2006 Speedrun (RMI21_speedrun) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "speedrun.h"
using namespace std;
typedef int ll;
ll c[1100],d[1100],z;
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[])
{
    vector<ll> v[1100];
    ll i,n,h[1100],x;
    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;
    
        if(c[x]==0)
        {
            c[x]=1;
            y=0;
            r=1;
            for(i=1;i<=10;i++)
            {
                z=getHint();
                if(z==1)
                    y+=r;
                r*=2;
            }
            b[x]=y;
            y=0;
            r=1;
            for(i=1;i<=10;i++)
            {
                z=getHint();
                if(z==1)
                    y+=r;
                r*=2;
            }
            a[x]=y;
        }
        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();
                if(z==1)
                    y+=r;
                r*=2;
            }
            b[x]=y;
            y=0;
            r=1;
            for(i=1;i<=10;i++)
            {
                z=getHint();
                if(z==1)
                    y+=r;
                r*=2;
            }
            a[x]=y;
        }
        x=b[x];
        t=goTo(x);
    }
    g(x,0);
}

Compilation message

speedrun.cpp: In function 'void f(ll, ll)':
speedrun.cpp:12:15: error: 'h' was not declared in this scope
   12 |     for(i=0;i<h[x];i++)
      |               ^
speedrun.cpp:14:12: error: 'v' was not declared in this scope
   14 |         if(v[x][i]==y)
      |            ^
speedrun.cpp:16:11: error: 'v' was not declared in this scope
   16 |         f(v[x][i],x);
      |           ^
speedrun.cpp: In function 'void assignHints(ll, ll, ll*, ll*)':
speedrun.cpp:38:13: error: 'j' was not declared in this scope
   38 |         for(j=1;j<=10;j++)
      |             ^
speedrun.cpp:44:13: error: 'j' was not declared in this scope
   44 |         for(j=11;j<=20;j++)
      |             ^
speedrun.cpp: In function 'll g(ll, ll)':
speedrun.cpp:60:13: error: 'r' was not declared in this scope
   60 |             r=1;
      |             ^
speedrun.cpp:63:27: error: too few arguments to function 'bool getHint(int)'
   63 |                 z=getHint();
      |                           ^
In file included from speedrun.cpp:2:
speedrun.h:11:6: note: declared here
   11 | bool getHint(int j);
      |      ^~~~~~~
speedrun.cpp:73:27: error: too few arguments to function 'bool getHint(int)'
   73 |                 z=getHint();
      |                           ^
In file included from speedrun.cpp:2:
speedrun.h:11:6: note: declared here
   11 | bool getHint(int j);
      |      ^~~~~~~
speedrun.cpp: In function 'void speedrun(ll, ll, ll)':
speedrun.cpp:110:27: error: too few arguments to function 'bool getHint(int)'
  110 |                 z=getHint();
      |                           ^
In file included from speedrun.cpp:2:
speedrun.h:11:6: note: declared here
   11 | bool getHint(int j);
      |      ^~~~~~~
speedrun.cpp:120:27: error: too few arguments to function 'bool getHint(int)'
  120 |                 z=getHint();
      |                           ^
In file included from speedrun.cpp:2:
speedrun.h:11:6: note: declared here
   11 | bool getHint(int j);
      |      ^~~~~~~