Submission #41772

# Submission time Handle Problem Language Result Execution time Memory
41772 2018-02-21T08:01:30 Z cmaster Amusement Park (JOI17_amusement_park) C++14
Compilation error
0 ms 0 KB
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
static const int MAXN1 = (int)2e5+228;
static bool used1[MAXN1];
static vector < int > g1[MAXN1];
static int val1[MAXN1];
static long long ret = 0ll;

/*void dfs11(int v, int len = 0) {
	used1[v] = 1;
	if(len < 60) ret ^= (1ll << len*1ll) * val1[v];
	for(auto &to : g1[v]) {
		if(!used1[to]) {
			dfs11(to, len+1);
		}
	}
}*/

long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
	for(int i = 0; i < n; ++i) {
		used1[i] = 0;
		val1[i] = -1;
		g1[i].clear();
	}
	val1[P] = V;
	for(int i = 0; i < m; ++i) {
		g1[A[i]].push_back(B[i]);
		g1[B[i]].push_back(A[i]);
	}
	ret = 0ll;
	while(1) {
		bool ok = 0;
		for(auto &to : g1[P]) {
			if(val[to] == -1) {
				ok = 1;
				val[to] = Move(to);
				P = to;
				break;
			}
		}
		if(!ok) break;
	}
	/*for(int i = 0; i < n; ++i) used1[i] = 0;
	dfs11(0);*/
  return ret;
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
static const int MAXN1 = (int)2e5+228;
static bool used1[MAXN1];
static vector < int > g1[MAXN1];
static int val1[MAXN1];
static long long ret = 0ll;
void dfs1(int v, int pr = -1) {
	for(auto &to : g1[v]) {
		if(val1[to] == -1) {
			val1[to] = Move(to);
			dfs1(to, v);
		}
	}
	if(pr >= 0) Move(pr);
}
/*void dfs11(int v, int len = 0) {
	used1[v] = 1;
	if(len < 60) ret ^= (1ll << len*1ll) * val1[v];
	for(auto &to : g1[v]) {
		if(!used1[to]) {
			dfs11(to, len+1);
		}
	}
}*/

long long Ioi(int n, int m, int A[], int B[], int P, int V, int T) {
	for(int i = 0; i < n; ++i) {
		used1[i] = 0;
		val1[i] = -1;
		g1[i].clear();
	}
	val1[P] = V;
	for(int i = 0; i < m; ++i) {
		g1[A[i]].push_back(B[i]);
		g1[B[i]].push_back(A[i]);
	}
	ret = 0ll;
	dfs1(P);
	/*for(int i = 0; i < n; ++i) used1[i] = 0;
	dfs11(0);*/
  return ret;
}

Compilation message

Joi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Joi.cpp:35:7: error: 'val' was not declared in this scope
    if(val[to] == -1) {
       ^
Joi.cpp:37:22: error: 'Move' was not declared in this scope
     val[to] = Move(to);
                      ^