Submission #998967

#TimeUsernameProblemLanguageResultExecution timeMemory
998967THXuanSeptember (APIO24_september)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "september.h"
#include <bits/stdc++.h>
#define INF 1e18
using namespace std;
typedef long long ll;
 
vector<int>adj[800005];
bool visited[800005];
int v = 0;
 
void dfs(int s, int e){
    if(visited[s]) return;
    visited[s] = true;
    ++v;
    for(auto u : adj[s]){
        if(u==e) continue;
        dfs(u, s);
    }
}
 
int solve(int N, int M, vector<int> F, vector<vector<int>>S) {
    for(int i =1; i < N;i++){
        adj[i].push_back(F[i]);
        adj[F[i]].push_back(i);
    }
    int ans = 0;
    for(int i =0;i<N-1;i++){
        for(int j =0;j<M;j++)dfs(S[j][i]);
        ans += !--v;
    }
    return ans;
}

Compilation message (stderr)

september.cpp: In function 'int solve(int, int, std::vector<int>, std::vector<std::vector<int> >)':
september.cpp:29:41: error: too few arguments to function 'void dfs(int, int)'
   29 |         for(int j =0;j<M;j++)dfs(S[j][i]);
      |                                         ^
september.cpp:12:6: note: declared here
   12 | void dfs(int s, int e){
      |      ^~~