답안 #871707

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871707 2023-11-11T10:56:30 Z TAhmed33 Speedrun (RMI21_speedrun) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "speedrun.h"
vector <int> adj[2001];
int parent[2001];
vector <int> ord;
void dfs (int pos, int par) {
	for (int i = 1; i <= 10; i++) {
		if (par & (1 << (i - 1))) {
			setHint(x, i, 1);
		}
	}
	ord.push_back(pos);
	for (auto j : adj[pos]) {
		if (j != par) dfs(j);
	}
}
void assignHints (int subtask, int n, int a[], int b[]) {
	if (n == 1) return;
	for (int i = 1; i < n; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	setHintLen(20);
	dfs(1, 0);	
	for (int i = 1; i < n; i++) {
		int x = ord[i - 1];
		for (int j = 1; j <= 10; j++) {
			if (x & (1 << (j - 1))) {
				setHint(ord[i], j + 10, 1);
			}
		}
	}
}
int getpar () {
	int ret = 0;
	for (int i = 10; i >= 1; i--) {
		ret *= 2; ret += getHint(i);
	}
	return ret;
}
int getnext () {
	int ret = 0;
	for (int i = 20; i >= 11; i--) {
		ret *= 2; ret += getHint(i);
	}
	return ret;
}
void speedrun (int subtask, int n, int start) {
	while (start > 1) {
		start = getpar();
		goTo(start);
	}
	for (int i = 2; i <= n; i++) {
		int x = getnext();
		while (goTo(x) == 0) goTo(getpar());
	}
}

Compilation message

speedrun.cpp: In function 'void dfs(int, int)':
speedrun.cpp:10:12: error: 'x' was not declared in this scope
   10 |    setHint(x, i, 1);
      |            ^
speedrun.cpp:15:22: error: too few arguments to function 'void dfs(int, int)'
   15 |   if (j != par) dfs(j);
      |                      ^
speedrun.cpp:7:6: note: declared here
    7 | void dfs (int pos, int par) {
      |      ^~~