답안 #394657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
394657 2021-04-27T07:01:27 Z jsannemo Amusement Park (JOI17_amusement_park) C++14
28 / 100
38 ms 5304 KB
#include "Joi.h"

#include <vector>
#include <map>

using namespace std;

static vector<vector<int>> adj;

static vector<int> ord;
static vector<int> vis;
static vector<bool> seen;

static void dfs(int at) {
	seen[at] = true;
	vis.push_back(at);
	ord.push_back(at);
	for (int it : adj[at]) {
		if (seen[it]) continue;
		dfs(it);
		ord.push_back(at);
	}
}

void Joi(int N, int M, int A[], int B[], long long X, int T) {
	adj.resize(N);
	seen.resize(N);
	for (int i = 0; i < M; i ++) {
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	dfs(0);
	ord.pop_back();
	for(int i = 0; i < N - 60; i++){
		int b = (i % 60);
		MessageBoard(vis[i], (X >> b) & 1);
	}
	for(int i = N - 60; i < N; i++){
		int b = i - (N - 60);
		MessageBoard(vis[i], (X >> b) & 1);
	}
}
#include "Ioi.h"

#include <vector>
#include <map>
#include <algorithm>
#include <iostream>

using namespace std;

static vector<vector<int>> adj;

static vector<int> ord;
static vector<int> vis;
static vector<bool> seen;

static void dfs(int at) {
	seen[at] = true;
	vis.push_back(at);
	ord.push_back(at);
	for (int it : adj[at]) {
		if (seen[it]) continue;
		dfs(it);
		ord.push_back(at);
	}
}

static map<int, int> bits;
static map<int, int> bit;

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	adj.resize(N);
	seen.resize(N);
	for (int i = 0; i < M; i ++) {
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	dfs(0);
	ord.pop_back();
	for(int i = 0; i < N - 60; i++){
		int b = (i % 60);
		bit[vis[i]] = b;
	}
	for(int i = N - 60; i < N; i++){
		int b = i - (N - 60);
		bit[vis[i]] = b;
	}

	int idx = find(vis.begin(), vis.end(), P) - vis.begin();
	int d = 1;
	if (idx < N - 60) d = -1;

	int at = find(ord.begin(), ord.end(), P) - ord.begin();
	while (bits.size() != 60) {
		at = (at + d + ord.size()) % ord.size();
		cerr << "go to " << ord[at] << " get bit " << bit[ord[at]] << endl;
		bits[bit[ord[at]]] = Move(ord[at]);
	}

	long long X = 0;
	for (int i = 0; i < 60; ++i) {
		X |= (long long)bits[i] << i;
	}
	return X;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 628 KB Output is correct
2 Correct 3 ms 616 KB Output is correct
3 Correct 3 ms 752 KB Output is correct
4 Correct 2 ms 624 KB Output is correct
5 Correct 2 ms 624 KB Output is correct
6 Correct 3 ms 628 KB Output is correct
7 Correct 3 ms 752 KB Output is correct
8 Correct 3 ms 752 KB Output is correct
9 Correct 3 ms 752 KB Output is correct
10 Correct 3 ms 628 KB Output is correct
11 Correct 6 ms 1108 KB Output is correct
12 Correct 3 ms 492 KB Output is correct
13 Correct 3 ms 716 KB Output is correct
14 Correct 3 ms 756 KB Output is correct
15 Correct 3 ms 768 KB Output is correct
16 Correct 3 ms 760 KB Output is correct
17 Correct 3 ms 752 KB Output is correct
18 Correct 3 ms 752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 35 ms 5204 KB Output is correct
2 Correct 31 ms 5304 KB Output is correct
3 Correct 34 ms 5296 KB Output is correct
4 Correct 23 ms 3612 KB Output is correct
5 Correct 19 ms 4248 KB Output is correct
6 Correct 19 ms 3864 KB Output is correct
7 Correct 19 ms 4052 KB Output is correct
8 Correct 20 ms 3996 KB Output is correct
9 Correct 19 ms 4124 KB Output is correct
10 Correct 18 ms 3620 KB Output is correct
11 Correct 18 ms 3636 KB Output is correct
12 Correct 18 ms 3400 KB Output is correct
13 Correct 17 ms 3268 KB Output is correct
14 Correct 20 ms 3420 KB Output is correct
15 Correct 19 ms 3612 KB Output is correct
16 Correct 22 ms 3556 KB Output is correct
17 Correct 19 ms 3596 KB Output is correct
18 Correct 19 ms 3616 KB Output is correct
19 Correct 18 ms 3624 KB Output is correct
20 Correct 36 ms 4236 KB Output is correct
21 Correct 38 ms 4144 KB Output is correct
22 Correct 25 ms 3844 KB Output is correct
23 Correct 19 ms 3992 KB Output is correct
24 Correct 19 ms 3856 KB Output is correct
25 Correct 19 ms 3904 KB Output is correct
26 Correct 19 ms 4004 KB Output is correct
27 Correct 19 ms 3992 KB Output is correct
28 Correct 19 ms 4012 KB Output is correct
29 Correct 17 ms 3712 KB Output is correct
30 Correct 24 ms 3820 KB Output is correct
31 Correct 3 ms 620 KB Output is correct
32 Correct 2 ms 620 KB Output is correct
33 Correct 3 ms 752 KB Output is correct
34 Correct 2 ms 632 KB Output is correct
35 Correct 2 ms 716 KB Output is correct
36 Correct 2 ms 620 KB Output is correct
37 Correct 3 ms 500 KB Output is correct
38 Correct 2 ms 620 KB Output is correct
39 Correct 3 ms 620 KB Output is correct
40 Correct 2 ms 620 KB Output is correct
41 Correct 3 ms 628 KB Output is correct
42 Correct 3 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 628 KB Output is correct
2 Correct 3 ms 628 KB Output is correct
3 Correct 3 ms 620 KB Output is correct
4 Correct 4 ms 1308 KB Output is correct
5 Correct 4 ms 1300 KB Output is correct
6 Correct 5 ms 1300 KB Output is correct
7 Correct 4 ms 1300 KB Output is correct
8 Correct 4 ms 1312 KB Output is correct
9 Correct 18 ms 4716 KB Output is correct
10 Correct 17 ms 4696 KB Output is correct
11 Correct 16 ms 4760 KB Output is correct
12 Correct 2 ms 608 KB Output is correct
13 Correct 2 ms 628 KB Output is correct
14 Correct 2 ms 500 KB Output is correct
15 Correct 2 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 32 ms 5228 KB Output is correct
2 Partially correct 30 ms 5192 KB Partially correct
3 Partially correct 30 ms 5244 KB Partially correct
4 Partially correct 19 ms 3680 KB Partially correct
5 Correct 19 ms 4624 KB Output is correct
6 Correct 19 ms 4120 KB Output is correct
7 Correct 19 ms 4100 KB Output is correct
8 Correct 18 ms 3864 KB Output is correct
9 Correct 19 ms 3872 KB Output is correct
10 Correct 22 ms 3588 KB Output is correct
11 Correct 18 ms 3612 KB Output is correct
12 Partially correct 18 ms 3324 KB Partially correct
13 Correct 17 ms 3328 KB Output is correct
14 Correct 18 ms 3372 KB Output is correct
15 Correct 18 ms 3612 KB Output is correct
16 Partially correct 22 ms 3592 KB Partially correct
17 Partially correct 18 ms 3604 KB Partially correct
18 Partially correct 23 ms 3556 KB Partially correct
19 Correct 23 ms 3560 KB Output is correct
20 Incorrect 37 ms 4248 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 5248 KB Output is correct
2 Correct 28 ms 5272 KB Output is correct
3 Incorrect 31 ms 5248 KB Output isn't correct
4 Halted 0 ms 0 KB -