답안 #670981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670981 2022-12-11T15:18:38 Z US3RN4M3 Amusement Park (JOI17_amusement_park) C++17
10 / 100
25 ms 4700 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);
		graph[y].push_back(x);
	}

	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);
		graph[y].push_back(x);
	}

	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(euler_path[i]);
	for(int i = 1; i < path_len; i++) euler_path.push_back(euler_path[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 Correct 0 ms 508 KB Output is correct
2 Incorrect 1 ms 512 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 4640 KB Output is correct
2 Correct 23 ms 4524 KB Output is correct
3 Incorrect 24 ms 4700 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 512 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Correct 0 ms 512 KB Output is correct
4 Correct 2 ms 1308 KB Output is correct
5 Correct 2 ms 1316 KB Output is correct
6 Correct 3 ms 1316 KB Output is correct
7 Correct 3 ms 1308 KB Output is correct
8 Correct 2 ms 1316 KB Output is correct
9 Correct 11 ms 4376 KB Output is correct
10 Correct 11 ms 4300 KB Output is correct
11 Correct 14 ms 4372 KB Output is correct
12 Correct 0 ms 520 KB Output is correct
13 Correct 1 ms 520 KB Output is correct
14 Correct 0 ms 520 KB Output is correct
15 Correct 0 ms 516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 25 ms 4608 KB Output is correct
2 Correct 24 ms 4624 KB Output is correct
3 Incorrect 23 ms 4696 KB Wrong Answer [7]
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 4564 KB Output is correct
2 Incorrect 24 ms 4676 KB Wrong Answer [7]
3 Halted 0 ms 0 KB -