Submission #1292841

#TimeUsernameProblemLanguageResultExecution timeMemory
1292841kahoulStations (IOI20_stations)C++20
Compilation error
0 ms0 KiB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 1003;
const int maxk = 12;
vector<int> rel[maxn];
int in[maxn];
int out[maxn];

int dp[maxn][maxk];
bool dfs (int u, int p, int q) {
	if (maxn < u) return 0;
	if (u == q) return 1;
	if (u / 2 != p) {
		if (dfs(u / 2, u)) return 1;
	}
	if (u * 2 != p) {
		if (dfs(u * 2, u)) return 1;
	}
	if (u * 2 + 1 != p) {
		if (dfs(u * 2 + 1, u)) return 1;
	}
	return 0;
}

vector<int> label(int n, int k, vector<int> u, vector<int> v) {
	vector<int> labels(n, 0);
	for (int i = 0; i < n -1; i++) {
		labels[i] = i;
	}
	return labels;
}

int find_next_station(int u, int t, vector<int> adj) {
	set<int> exists;
	for (auto v : exists) {
		exists.insert(v);
	}
	if (adj.size() == 1) return adj[0];

	if (exists.count(u / 2) && dfs(u / 2, u, t)) return u / 2;
	if (exists.count(u * 2) && dfs(u * 2, u, t)) return u * 2;
	if (exists.count(u * 2 + 1) && dfs(u * 2 + 1, u, t)) return u * 2 + 1;
}

Compilation message (stderr)

stations.cpp: In function 'bool dfs(int, int, int)':
stations.cpp:16:24: error: too few arguments to function 'bool dfs(int, int, int)'
   16 |                 if (dfs(u / 2, u)) return 1;
      |                     ~~~^~~~~~~~~~
stations.cpp:12:6: note: declared here
   12 | bool dfs (int u, int p, int q) {
      |      ^~~
stations.cpp:19:24: error: too few arguments to function 'bool dfs(int, int, int)'
   19 |                 if (dfs(u * 2, u)) return 1;
      |                     ~~~^~~~~~~~~~
stations.cpp:12:6: note: declared here
   12 | bool dfs (int u, int p, int q) {
      |      ^~~
stations.cpp:22:24: error: too few arguments to function 'bool dfs(int, int, int)'
   22 |                 if (dfs(u * 2 + 1, u)) return 1;
      |                     ~~~^~~~~~~~~~~~~~
stations.cpp:12:6: note: declared here
   12 | bool dfs (int u, int p, int q) {
      |      ^~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^