Submission #1199671

#TimeUsernameProblemLanguageResultExecution timeMemory
1199671herissonwow2Race (IOI11_race)C++20
Compilation error
0 ms0 KiB
#include "race.h"
#include <vector>
#include <queue>
#include <iostream>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

using namespace std;
const int N = 200001;
int att[N];
int biju[N];
int len[N];
vector<vector<pair<int,int>>> g;
void DFS(int v1, int vamount){
    for(auto p : g[v1]){
        if(!biju[p.second]){
            att[p.second] = att[v1] + att[p.first];
            len[p.second] = len[v1] + 1;
            DFS(p.second);
        }
    }
}

int best_path(int N, int K, int H[][2], int L[])
{
    for(int i = 0;i < N - 1;i++)
    {
        int u = H[i][0], v = H[i][1], w = L[i];
        g[u].pb({v, w});
        g[v].pb({u, w});
    }
    int res = -1;
    for(int i = 0; i < N; i++){
        //fill(att,att+N, 0);
        fill(biju,biju+N, 0);
        att[i] = len[i] = 0;
        biju[i] = 1;
        DFS(i);
        for(int j = 0;j < N;j++)
            if(att[j] == K && (res == -1 || len[j] < res))
                res = len[j];
    }
    //cout << res/2;
    return res;

}

Compilation message (stderr)

race.cpp: In function 'void DFS(int, int)':
race.cpp:19:16: error: too few arguments to function 'void DFS(int, int)'
   19 |             DFS(p.second);
      |             ~~~^~~~~~~~~~
race.cpp:14:6: note: declared here
   14 | void DFS(int v1, int vamount){
      |      ^~~
race.cpp: In function 'int best_path(int, int, int (*)[2], int*)':
race.cpp:29:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<int, int> > >, std::vector<std::pair<int, int> > >::value_type' {aka 'class std::vector<std::pair<int, int> >'} has no member named 'pb'
   29 |         g[u].pb({v, w});
      |              ^~
race.cpp:30:14: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::pair<int, int> > >, std::vector<std::pair<int, int> > >::value_type' {aka 'class std::vector<std::pair<int, int> >'} has no member named 'pb'
   30 |         g[v].pb({u, w});
      |              ^~
race.cpp:38:12: error: too few arguments to function 'void DFS(int, int)'
   38 |         DFS(i);
      |         ~~~^~~
race.cpp:14:6: note: declared here
   14 | void DFS(int v1, int vamount){
      |      ^~~