Submission #647358

# Submission time Handle Problem Language Result Execution time Memory
647358 2022-10-02T09:48:12 Z Niya Speedrun (RMI21_speedrun) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "speedrun.h"
using namespace std;

const int maxn = 1024;
vector<int>v[maxn];
vector<int>tour;
int used[maxn];

void set_parent( int nb, int par )
{
    int cnt = 1;
    while( par != 0 )
    {
        setHint(nb,cnt,(par%2));
        par /= 2;
    }
}

void dfs( int w )
{
    used[w] = 1;
    tour.push_back(w);
    int sz = v[w].size();

    for( int i = 0; i < sz; i ++ )
    {
        int nb = v[w][i];
        if( used[nb] == 0 )
        {
            set_parent(nb,w);
            dfs(nb);
        }
    }
}

void set_next( int x, int y )
{
    int cnt = 11;
    while( y != 0 )
    {
        setHint(x,cnt,(y%2));
        y /= 2;
    }
}
void assignHints(int subtask, int N, int A[], int B[] )
{
    setHintLen(20);
    for( int i = 1; i < N; i ++ )
    {
        v[A[i]].push_back(B[i]);
        v[B[i]].push_back(A[i]);
    }

    int sz = tour.size();
    for( int i = 0; i < sz-1; i ++ )
    {
        int x = v[i];
        int y = v[i+1];
        set_next(x,y);
    }
}

void speedrun(int subtask, int N, int start)
{
    return 0;
}

Compilation message

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:58:20: error: cannot convert 'std::vector<int>' to 'int' in initialization
   58 |         int x = v[i];
      |                 ~~~^
      |                    |
      |                    std::vector<int>
speedrun.cpp:59:22: error: cannot convert 'std::vector<int>' to 'int' in initialization
   59 |         int y = v[i+1];
      |                 ~~~~~^
      |                      |
      |                      std::vector<int>
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:66:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   66 |     return 0;
      |            ^