제출 #718142

#제출 시각아이디문제언어결과실행 시간메모리
718142mseebacherSplit the Attractions (IOI19_split)C++17
컴파일 에러
0 ms0 KiB
#include "split.h"
#include <bits/stdc++.h>

using namespace std;


#define MAX_N (int) 1e5+5
vector<int> ad[MAX_N];
vector<int> res;
vector<bool> vis(MAX_N);

void dfs(int x,int a,int b,int c){
	if(vis[x]) return;
	vis[x] = 1;
	if(a > 0){
		res[x] = 1;
		--a;
	}else if(b > 0){
		res[x] = 2;
		--b;
	}else{
		res[x] = 3;
	}
	for(auto s: ad[x]){
		dfs(s,x,a,b,c);
	}
}

vector<int> find_split(int n, int a, int b, int c, vector<int> p, vector<int> q) {
	for(int i = 0;i<m;i++){
		ad[p[i]].push_back(q[i]);
		ad[q[i]].push_back(p[i]);
	}
	res.assign(n,0);
	int start = 0;
	for(int i = 0;i<n;i++){
		if(ad[i].size() == 1){
			start = i;
			break;
		}
	}
	dfs(start,a,b,c);
	return res;
}

컴파일 시 표준 에러 (stderr) 메시지

split.cpp: In function 'void dfs(int, int, int, int)':
split.cpp:25:16: error: too many arguments to function 'void dfs(int, int, int, int)'
   25 |   dfs(s,x,a,b,c);
      |                ^
split.cpp:12:6: note: declared here
   12 | void dfs(int x,int a,int b,int c){
      |      ^~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:30:18: error: 'm' was not declared in this scope
   30 |  for(int i = 0;i<m;i++){
      |                  ^