답안 #130665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130665 2019-07-15T19:29:29 Z tutis Amusement Park (JOI17_amusement_park) C++17
75 / 100
164 ms 7640 KB
#include "Joi.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
mt19937_64 rng(1561561);
int bitas[11000];
vector<int>adj[11000];
set<int>aplankyta;
int t = 0;
set<pair<int, int>>EE;
void dfs(int v, int p = -2)
{
	if (aplankyta.count(v))
		return;
	EE.insert({v, p});
	EE.insert({p, v});
	aplankyta.insert(v);
	t++;
	t %= 60;
	bitas[v] = t;
	for (int x : adj[v])
	{
		dfs(x,v);
	}
}
void Joi(int N, int M, int A[], int B[], long long X, int T) {
	vector<int>PP(N);
	iota(PP.begin(), PP.end(), 0);
	shuffle(PP.begin(), PP.end(), mt19937_64(15651));
	for (int i = 0; i < M; i++)
	{
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	for (int i = 0; i < N; i++)
		shuffle(adj[i].begin(), adj[i].end(), rng);
	dfs(rng() % N);
	for (int i = 0; i < N; i++)
	{
		int s = 0;
		if ((X & (1ll << bitas[i])) > 0)
			s = 1;
		MessageBoard(i, s);
	}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937_64 rng(1561561);
int bitas[11000];
vector<int>adj[11000];
set<int>aplankyta;
int t = 0;
set<pair<int, int>>EE;
void dfs(int v, int p = -2)
{
	if (aplankyta.count(v))
		return;
	EE.insert({v, p});
	EE.insert({p, v});
	aplankyta.insert(v);
	t++;
	t %= 60;
	bitas[v] = t;
	for (int x : adj[v])
	{
		dfs(x,v);
	}
}
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T)
{
	vector<int>PP(N);
	iota(PP.begin(), PP.end(), 0);
	shuffle(PP.begin(), PP.end(), mt19937_64(15651));
	for (int i = 0; i < M; i++)
	{
		adj[A[i]].push_back(B[i]);
		adj[B[i]].push_back(A[i]);
	}
	for (int i = 0; i < N; i++)
		shuffle(adj[i].begin(), adj[i].end(), rng);
	dfs(rng() % N);
	ll X = 0;
	vector<int>stak = {P};
	set<int>bitai;
	set<int>aplankyti;
	while (true)
	{
		X |= V * (1ll << bitas[P]);
		bitai.insert(bitas[P]);
		aplankyti.insert(P);
		if (bitai.size() == 60)
			break;
		int v1 = -1;
		int v2 = -1;
		for (int j : adj[P])
			if (aplankyti.count(j) == false)
			{
				if (EE.count({P, j}) == 0)
					continue;
				v1 = j;
				if (bitas[j] == ((bitas[P] + 1) % 60) && bitai.count(bitas[j]) == 0)
					v2 = j;
			}
		if (v2 != -1)
			v1 = v2;
		if (v1 == -1)
		{
			stak.pop_back();
			v1 = stak.back();
		}
		else
		{
			stak.push_back(v1);
		}
		V = Move(v1);
		P = v1;
	}
	return X;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1468 KB Output is correct
2 Correct 4 ms 1320 KB Output is correct
3 Correct 6 ms 1424 KB Output is correct
4 Correct 4 ms 1452 KB Output is correct
5 Correct 4 ms 1460 KB Output is correct
6 Correct 4 ms 1448 KB Output is correct
7 Correct 6 ms 1432 KB Output is correct
8 Correct 6 ms 1432 KB Output is correct
9 Correct 6 ms 1400 KB Output is correct
10 Correct 4 ms 1400 KB Output is correct
11 Correct 10 ms 1860 KB Output is correct
12 Correct 4 ms 1400 KB Output is correct
13 Correct 6 ms 1564 KB Output is correct
14 Correct 6 ms 1408 KB Output is correct
15 Correct 5 ms 1400 KB Output is correct
16 Correct 6 ms 1400 KB Output is correct
17 Correct 6 ms 1400 KB Output is correct
18 Correct 5 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 67 ms 7152 KB Output is correct
2 Correct 69 ms 7244 KB Output is correct
3 Correct 74 ms 7484 KB Output is correct
4 Correct 52 ms 5688 KB Output is correct
5 Correct 48 ms 6264 KB Output is correct
6 Correct 50 ms 6156 KB Output is correct
7 Correct 47 ms 6316 KB Output is correct
8 Correct 47 ms 6288 KB Output is correct
9 Correct 48 ms 6412 KB Output is correct
10 Correct 147 ms 5888 KB Output is correct
11 Correct 164 ms 5824 KB Output is correct
12 Correct 41 ms 5164 KB Output is correct
13 Correct 40 ms 5288 KB Output is correct
14 Correct 46 ms 5476 KB Output is correct
15 Correct 46 ms 5688 KB Output is correct
16 Correct 62 ms 5688 KB Output is correct
17 Correct 45 ms 5784 KB Output is correct
18 Correct 45 ms 5688 KB Output is correct
19 Correct 44 ms 5792 KB Output is correct
20 Correct 28 ms 5988 KB Output is correct
21 Correct 28 ms 6032 KB Output is correct
22 Correct 46 ms 6104 KB Output is correct
23 Correct 48 ms 6404 KB Output is correct
24 Correct 47 ms 5944 KB Output is correct
25 Correct 47 ms 6328 KB Output is correct
26 Correct 48 ms 6388 KB Output is correct
27 Correct 46 ms 6312 KB Output is correct
28 Correct 48 ms 6096 KB Output is correct
29 Correct 42 ms 5728 KB Output is correct
30 Correct 46 ms 5972 KB Output is correct
31 Correct 4 ms 1452 KB Output is correct
32 Correct 4 ms 1400 KB Output is correct
33 Correct 7 ms 1436 KB Output is correct
34 Correct 6 ms 1276 KB Output is correct
35 Correct 5 ms 1464 KB Output is correct
36 Correct 5 ms 1280 KB Output is correct
37 Correct 4 ms 1476 KB Output is correct
38 Correct 4 ms 1264 KB Output is correct
39 Correct 4 ms 1400 KB Output is correct
40 Correct 4 ms 1264 KB Output is correct
41 Correct 4 ms 1496 KB Output is correct
42 Correct 4 ms 1392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1392 KB Output is correct
2 Correct 4 ms 1392 KB Output is correct
3 Correct 4 ms 1264 KB Output is correct
4 Correct 8 ms 2192 KB Output is correct
5 Correct 8 ms 2220 KB Output is correct
6 Correct 8 ms 2200 KB Output is correct
7 Correct 8 ms 2216 KB Output is correct
8 Correct 8 ms 2200 KB Output is correct
9 Correct 30 ms 6640 KB Output is correct
10 Correct 31 ms 6840 KB Output is correct
11 Correct 28 ms 6328 KB Output is correct
12 Correct 6 ms 1264 KB Output is correct
13 Correct 4 ms 1412 KB Output is correct
14 Correct 4 ms 1264 KB Output is correct
15 Correct 4 ms 1400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 68 ms 7316 KB Partially correct
2 Partially correct 69 ms 7176 KB Partially correct
3 Correct 74 ms 7364 KB Output is correct
4 Partially correct 46 ms 5668 KB Partially correct
5 Correct 46 ms 6592 KB Output is correct
6 Partially correct 46 ms 6120 KB Partially correct
7 Correct 48 ms 6180 KB Output is correct
8 Correct 46 ms 5944 KB Output is correct
9 Correct 47 ms 6260 KB Output is correct
10 Correct 146 ms 5824 KB Output is correct
11 Correct 145 ms 5824 KB Output is correct
12 Correct 41 ms 5352 KB Output is correct
13 Partially correct 41 ms 5304 KB Partially correct
14 Correct 43 ms 5432 KB Output is correct
15 Partially correct 46 ms 5932 KB Partially correct
16 Partially correct 46 ms 5764 KB Partially correct
17 Partially correct 47 ms 5756 KB Partially correct
18 Partially correct 44 ms 5760 KB Partially correct
19 Partially correct 46 ms 5756 KB Partially correct
20 Correct 28 ms 6104 KB Output is correct
21 Correct 28 ms 6168 KB Output is correct
22 Correct 47 ms 6252 KB Output is correct
23 Correct 48 ms 6204 KB Output is correct
24 Correct 45 ms 6180 KB Output is correct
25 Correct 45 ms 6072 KB Output is correct
26 Correct 46 ms 6336 KB Output is correct
27 Correct 46 ms 6208 KB Output is correct
28 Correct 46 ms 6268 KB Output is correct
29 Correct 43 ms 5544 KB Output is correct
30 Correct 46 ms 5808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 7152 KB Output is correct
2 Correct 71 ms 7640 KB Output is correct
3 Correct 71 ms 7588 KB Output is correct
4 Incorrect 49 ms 5920 KB Output isn't correct
5 Halted 0 ms 0 KB -