Submission #1025867

# Submission time Handle Problem Language Result Execution time Memory
1025867 2024-07-17T10:53:04 Z parsadox2 Toy Train (IOI17_train) C++17
Compilation error
0 ms 0 KB
#include "train.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 5e3 + 10;

int n , m , st;
vector <int> adj[N];
bool dead[N] , marked[N] , cyc[N];
bool vis[N][2];

void Dfs(int v , int ty)
{
	vis[v][ty] = true;
	if(dead[v] && ty == 0)
	{
		Dfs(v , 1);
		return;
	}
	for(auto u : adj[v])
	{
		if(u == st && ty == 1)
			cyc[st] = true;
		if(!vis[u][ty])
			Dfs(u , ty);
	}
}

bool Solve(int v)
{
	marked[v] = true;
	if(cyc[v])
		return true;
	bool flg = false;
	for(auto u : adj[v])  if(!marked[u])
		flg |= Solve(u);
	return flg;
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size();
	m = u.size();
	vector<int> res(a.size());
	for(int i = 0 ; i < n ; i++)
		dead[i] = r[i];
	for(int i = 0 ; i < m ; i++)
		adj[u[i]].push_back(v[i]);
	for(int i = 0 ; i < n ; i++)  if(!dead[i])
	{
		//cout << "DFS " << i << endl;
		st = i;
		memset(vis , false , sizeof vis);
		Dfs(i);
	}
	for(int i = 0 ; i < n ; i++)
	{
		memset(marked , false , sizeof marked);
		res[i] = Solve(i);
	}
	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:54:8: error: too few arguments to function 'void Dfs(int, int)'
   54 |   Dfs(i);
      |        ^
train.cpp:13:6: note: declared here
   13 | void Dfs(int v , int ty)
      |      ^~~