답안 #670975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670975 2022-12-11T15:11:36 Z US3RN4M3 Amusement Park (JOI17_amusement_park) C++17
0 / 100
13 ms 4540 KB
#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
	vector<vector<int>> graph(N);
	vector<pair<int, int>> edges(M);
	for(int i = 0; i < M; i++) edges[i] = {min(A[i], B[i]), max(A[i], B[i])};
	sort(edges.begin(), edges.end());
	for(auto & [x, y] : edges) graph[x].push_back(y);

	int counter = 0;

	vector<bool> vis(N, false);
	vector<int> bit(N, 0);
	vector<int> euler_path;

	function<void(int)> dfs = [&](int cur) {
		vis[cur] = true;
		euler_path.push_back(cur);
		for(int nxt : graph[cur]) if(!vis[nxt]) {
			dfs(nxt);
			euler_path.push_back(cur);
		}
	};

	dfs(0);

	vis = vector<bool>(N, false);

	for(int & i : euler_path) {
		if(vis[i]) continue;
		vis[i] = true;
		bit[i] = (counter++) % 60;
		MessageBoard(i, (X >> (ll)bit[i]) & 1);
	}
}
#include "Ioi.h"

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	vector<vector<int>> graph(N);
	vector<pair<int, int>> edges(M);
	for(int i = 0; i < M; i++) edges[i] = {min(A[i], B[i]), max(A[i], B[i])};
	sort(edges.begin(), edges.end());
	for(auto & [x, y] : edges) graph[x].push_back(y);

	int counter = 0;

	vector<bool> vis(N, false);
	vector<int> bit(N, 0);
	vector<int> euler_path;

	function<void(int)> dfs = [&](int cur) {
		vis[cur] = true;
		euler_path.push_back(cur);
		for(int nxt : graph[cur]) if(!vis[nxt]) {
			dfs(nxt);
			euler_path.push_back(cur);
		}
	};

	dfs(0);

	vis = vector<bool>(N, false);

	for(int & i : euler_path) {
		if(vis[i]) {
			continue;
		}
		vis[i] = true;
		bit[i] = (counter++) % 60;
	}


	int path_len = euler_path.size();
	for(int i = 1; i < path_len; i++) euler_path.push_back(i);

	int start_pos = 0;
	while(euler_path[start_pos] != P) start_pos++;
	ll ans = (ll)V << bit[P];
	for(int i = start_pos + 1; i <= start_pos + 120; i++) {
		ans |= (ll)Move(euler_path[i]) << bit[euler_path[i]];
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 516 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 2044 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 528 KB Output is correct
2 Correct 0 ms 516 KB Output is correct
3 Correct 1 ms 516 KB Output is correct
4 Correct 3 ms 1324 KB Output is correct
5 Correct 2 ms 1324 KB Output is correct
6 Correct 2 ms 1332 KB Output is correct
7 Correct 2 ms 1332 KB Output is correct
8 Correct 3 ms 1316 KB Output is correct
9 Correct 11 ms 4540 KB Output is correct
10 Correct 11 ms 4508 KB Output is correct
11 Correct 13 ms 4532 KB Output is correct
12 Correct 0 ms 612 KB Output is correct
13 Correct 1 ms 524 KB Output is correct
14 Correct 0 ms 628 KB Output is correct
15 Incorrect 0 ms 524 KB Wrong Answer [6]
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1968 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 1996 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -