Submission #205542

# Submission time Handle Problem Language Result Execution time Memory
205542 2020-02-29T07:42:03 Z ArshiaDadras Amusement Park (JOI17_amusement_park) C++14
0 / 100
44 ms 4320 KB
/* In the name of Allah */
#include<bits/stdc++.h>
#include<Joi.h>
using namespace std;

const int N = 1e4 + 5;
vector<int> adj[N], V;
bool mark[N];

void dfs(int u) {
	sort(adj[u].begin(), adj[u].end());
	mark[u] = true, V.push_back(u);
	for (auto v: adj[u])
		if (!mark[v])
			dfs(v);
}

void Joi(int n, int m, int a[], int b[], long long x, int t) {
	for (int i = 0; i < m; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	dfs(0);
	for (int i = 0; i < n; i++)
		MessageBoard(V[i], i < 60? x >> i & 1: 0);
}
/* In the name of Allah */
#include<bits/stdc++.h>
#include<Ioi.h>
using namespace std;

const int N = 1e4 + 5;
vector<int> adj[N], V;
long long answer;
bool mark[N];

bool go(int u) {
	mark[u] = true;
	if (!u)
		return true;
	for (auto v: adj[u])
		if (!mark[v] && go(v)) {
			V.push_back(v);
			return true;
		}
	return false;
}

void dfs(int u, bool b) {
	static int id = 0;
	mark[u] = true;
	if (id >= 60)
		return;
	answer |= b << id++;
	sort(adj[u].begin(), adj[u].end());
	for (auto v: adj[u])
		if (!mark[v]) {
			dfs(v, Move(v));
			Move(u);
		}
}

long long Ioi(int n, int m, int a[], int b[], int p, int v, int t) {
	for (int i = 0; i < m; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	go(p), reverse(V.begin(), V.end());
	for (auto u: V)
		v = Move(p = u);
	memset(mark, false, sizeof mark), dfs(p, v);
	return answer;
}
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1512 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 4320 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 1268 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 4316 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 4072 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -