Submission #1118854

# Submission time Handle Problem Language Result Execution time Memory
1118854 2024-11-26T09:56:20 Z andrei_iorgulescu Speedrun (RMI21_speedrun) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "speedrun.h"

using namespace std;

int n;
vector<int> g[1005];
int preord[1005], cr;

void dfs(int nod, int tata)
{
    preord[++cr] = nod;
    for (int i = 0; i < 10; i++)
        setHint(nod, i + 1, (bool)(tata & (1 << i)));
    for (auto vecin : g[nod])
        if (vecin != tata)
            dfs(vecin, nod);
}

void assignHints(int subtask, int N, vector<int> A, vector<int> B)
{
    setHintLen(20);
    n = N;
    for (int i = 1; i < n; i++)
    {
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    dfs(1, 0);
    for (int i = 1; i <= n; i++)
    {
        int nd = preord[i], urm = preord[i % n + 1];
        for (int j = 10; j < 20; j++)
            setHint(nd, j + 1, (bool)(urm & (1 << (j - 10))));
    }
}

int u()
{
    int x = 0;
    for (int i = 10; i < 20; i++)
    {
        if (getHint(i + 1))
            x += (1 << (i - 10));
    }
    return x;
}

int tt()
{
    int x = 0;
    for (int i = 0; i < 10; i++)
    {
        if (getHint(i + 1))
            x += (1 << i);
    }
    return x;
}

void speedrun(int subtask, int N, int start)
{
    int nod = start;
    n = N;
    while (true)
    {
        int trg = u(nod);
        if (trg == start)
            break;
        while (true)
        {
            if (nod == trg)
                break;
            if (goTo(nod, trg))
            {
                nod = trg;
                break;
            }
            goTo(nod, tt());
            nod = tt();
        }
    }
}

Compilation message

speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:66:24: error: too many arguments to function 'int u()'
   66 |         int trg = u(nod);
      |                        ^
speedrun.cpp:38:5: note: declared here
   38 | int u()
      |     ^
speedrun.cpp:73:30: error: too many arguments to function 'bool goTo(int)'
   73 |             if (goTo(nod, trg))
      |                              ^
In file included from speedrun.cpp:2:
speedrun.h:12:6: note: declared here
   12 | bool goTo(int x);
      |      ^~~~
speedrun.cpp:78:27: error: too many arguments to function 'bool goTo(int)'
   78 |             goTo(nod, tt());
      |                           ^
In file included from speedrun.cpp:2:
speedrun.h:12:6: note: declared here
   12 | bool goTo(int x);
      |      ^~~~