Submission #1278613

#TimeUsernameProblemLanguageResultExecution timeMemory
1278613IBoryRace (IOI11_race)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define pii pair<int, int>
using namespace std;

const int MAX = 100007, LIM = 1000007;
int Z[MAX], V[MAX], D[LIM];
vector<pii> G[MAX];

int GetSize(int cur, int prev) {
	int& ret = Z[cur] = 1;
	for (auto [next, _] : G[cur]) {
		if (V[next] || next == prev) continue;
		ret += GetSize(next, cur);
	}
	return ret;
}

int GetCent(int cur, int prev, int lim) {
	for (auto [next, _] : G[cur]) {
		if (V[next] || next == prev) continue;
		if (Z[next] * 2 > lim) return GetCent(next, cur, lim);
	}
	return cur;
}

int temp;
vector<int> ST;
void DFS(int cur, int prev, int cnt, int cd, int K, bool upd) {
	if (cd > K) return;
	if (upd) temp = min(temp, cnt + D[K - cd]);
	else {
		D[cd] = min(D[cd], cnt);
		ST.push_back(cd);
	}
	for (auto [next, dist] : G[cur]) {
		if (V[next] || next == prev) continue;
		DFS(next, cur, cnt + 1, cd + dist, upd);
	}
}

int DnC(int cur, int K) {
	int C = GetCent(cur, -1, GetSize(cur, -1));
	V[C] = 1;

	int ret = 1e9;
	temp = 1e9;
	for (auto& [next, dist] : G[C]) {
		if (V[next] || dist > K) continue;
		DFS(next, -1, 1, dist, K, 1);
		DFS(next, -1, 1, dist, K, 0);
	}
	ret = min({ret, temp, D[K]});

	for (int n : ST) D[n] = 1e9;
	ST.clear();

	for (auto [next, _] : G[C]) if (!V[C]) ret = min(ret, DnC(next, K));
	return ret;
}

Compilation message (stderr)

race.cpp: In function 'void DFS(int, int, int, int, int, bool)':
race.cpp:37:20: error: too few arguments to function 'void DFS(int, int, int, int, int, bool)'
   37 |                 DFS(next, cur, cnt + 1, cd + dist, upd);
      |                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
race.cpp:28:6: note: declared here
   28 | void DFS(int cur, int prev, int cnt, int cd, int K, bool upd) {
      |      ^~~