답안 #407410

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
407410 2021-05-18T22:15:44 Z peuch Simurgh (IOI17_simurgh) C++17
컴파일 오류
0 ms 0 KB
#include "simurgh.h"
#include "simurgh.cpp"
#include <cstdio>
#include <cassert>
#include <vector>
#include <cstdlib>
#include <string>

using namespace std;

static int MAXQ = 30000;

static int N, M, Q = 0;
static vector<int> U, V;
static vector<bool> goal;

static void wrong_answer() {
	printf("NO\n");
	exit(0);
}

static bool is_valid(const vector<int>& r) {
	if(int(r.size()) != N - 1)
		return false;

	for(int i = 0; i < N - 1; i++)
		if (r[i] < 0 || r[i] >= M)
			return false;

	return true;
}

static int _count_common_roads_internal(const vector<int>& r) {
	if(!is_valid(r))
		wrong_answer();

	int common = 0;
	for(int i = 0; i < N - 1; i++) {
		bool is_common = goal[r[i]];
		if (is_common)
			common++;
	}

	return common;	
}

int count_common_roads(const vector<int>& r) {
	Q++;
	if(Q > MAXQ)
		wrong_answer();
		
	printf("\tTesting tree: ");
	for(int i = 0; i < r.size(); i++)
		printf("%d ", r[i]);
	printf("\n");

	return _count_common_roads_internal(r);
}

int main() {
	assert(2 == scanf("%d %d", &N, &M));

	U.resize(M);
	V.resize(M);

	for(int i = 0; i < M; i++)
		assert(2 == scanf("%d %d", &U[i], &V[i]));

	goal.resize(M, false);

	for(int i = 0; i < N - 1; i++) {
		int id;
		assert(1 == scanf("%d", &id));
		goal[id] = true;
	}

	vector<int> res = find_roads(N, U, V);

	if(_count_common_roads_internal(res) != N - 1)
		wrong_answer();

	printf("YES\n");

	return 0;
}

Compilation message

simurgh.cpp:2:10: fatal error: simurgh.cpp: No such file or directory
    2 | #include "simurgh.cpp"
      |          ^~~~~~~~~~~~~
compilation terminated.