Submission #166726

# Submission time Handle Problem Language Result Execution time Memory
166726 2019-12-03T14:18:04 Z igba Amusement Park (JOI17_amusement_park) C++14
82 / 100
51 ms 5384 KB
#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;
vector<int> JOIg[MAXN], JOIwg[MAXN];
bool JOIflg[MAXN];
int JOIgrp[MAXN], JOIgrpsz[MAXN], JOIcurgrp;

void JOIdfs(int v)
{
	JOIflg[v] = true;
	JOIgrp[v] = JOIcurgrp;
	JOIgrpsz[JOIcurgrp]++;
	JOIwg[JOIcurgrp].push_back(v);
	for(const int &u : JOIg[v])
		if(!JOIflg[u])
		{
			if(JOIgrpsz[JOIgrp[v]] == 60)
				JOIcurgrp++;
			JOIdfs(u);
		}
}

void Joi(int N, int M, int A[], int B[], long long X, int T)
{
	for(int i = 0; i < M; ++i)
		JOIg[A[i]].push_back(B[i]), JOIg[B[i]].push_back(A[i]);
	JOIdfs(0);

	for(int i = 0; i < N; ++i)
	{
		sort(JOIwg[i].begin(), JOIwg[i].end());
		for(int j = 0; j < JOIwg[i].size(); ++j)
			MessageBoard(JOIwg[i][j], (X >> j) & 1);
	}
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10010;
vector<int> IOIg[MAXN], IOIwg[MAXN];
bool IOIflg[MAXN], IOIsi[MAXN];
int IOIgrp[MAXN], IOIgrpsz[MAXN], IOIcurgrp, IOIparent[MAXN];

void IOIdfs(int v)
{
	IOIflg[v] = true;
	IOIgrp[v] = IOIcurgrp;
	IOIgrpsz[IOIcurgrp]++;
	IOIwg[IOIcurgrp].push_back(v);
	for(const int &u : IOIg[v])
		if(!IOIflg[u])
		{
			if(IOIgrpsz[IOIgrp[v]] == 60)
				IOIcurgrp++;
			IOIparent[u] = v;
			IOIdfs(u);
		}
}

void IOIsolve(int v)
{
	IOIflg[v] = true;
	for(const int &u : IOIg[v])
		if(!IOIflg[u])
		{
			if(IOIgrp[u] != IOIgrp[v])
				continue;
			IOIsi[u] = Move(u);
			IOIsolve(u);
			Move(v);
		}
}

long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	for(int i = 0; i < M; ++i)
		IOIg[A[i]].push_back(B[i]), IOIg[B[i]].push_back(A[i]);
	IOIdfs(0);
	for(int i = 0; i < N; ++i)
		sort(IOIwg[i].begin(), IOIwg[i].end());
	IOIsi[P] = V;
	while(IOIgrpsz[IOIgrp[P]] < 60)
	{
		IOIsi[IOIparent[P]] = Move(IOIparent[P]);
		P = IOIparent[P];
	}
	memset(IOIflg, 0, sizeof IOIflg);
	IOIsolve(P);

	long long ans = 0;
	for(int i = 0; i < 60; ++i)
	{
		ans |= (1LL << i) * IOIsi[IOIwg[IOIgrp[P]][i]];
	}
	//printf("ANS: %lld\n", ans);
	return ans;
}

Compilation message

Joi.cpp: In function 'void Joi(int, int, int*, int*, long long int, int)':
Joi.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 0; j < JOIwg[i].size(); ++j)
                  ~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1912 KB Output is correct
2 Correct 4 ms 1916 KB Output is correct
3 Correct 5 ms 1916 KB Output is correct
4 Correct 4 ms 1652 KB Output is correct
5 Correct 4 ms 1900 KB Output is correct
6 Correct 5 ms 1916 KB Output is correct
7 Correct 5 ms 1796 KB Output is correct
8 Correct 4 ms 1916 KB Output is correct
9 Correct 5 ms 1924 KB Output is correct
10 Correct 6 ms 1652 KB Output is correct
11 Correct 8 ms 2120 KB Output is correct
12 Correct 5 ms 1888 KB Output is correct
13 Correct 6 ms 1796 KB Output is correct
14 Correct 7 ms 1952 KB Output is correct
15 Correct 5 ms 2020 KB Output is correct
16 Correct 5 ms 2040 KB Output is correct
17 Correct 5 ms 1916 KB Output is correct
18 Correct 5 ms 1880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 4688 KB Output is correct
2 Correct 35 ms 5136 KB Output is correct
3 Correct 35 ms 5272 KB Output is correct
4 Correct 20 ms 3744 KB Output is correct
5 Correct 22 ms 4120 KB Output is correct
6 Correct 23 ms 3940 KB Output is correct
7 Correct 22 ms 3876 KB Output is correct
8 Correct 24 ms 4168 KB Output is correct
9 Correct 23 ms 4024 KB Output is correct
10 Correct 39 ms 4068 KB Output is correct
11 Correct 20 ms 4132 KB Output is correct
12 Correct 19 ms 3464 KB Output is correct
13 Correct 19 ms 3584 KB Output is correct
14 Correct 20 ms 3512 KB Output is correct
15 Correct 22 ms 3608 KB Output is correct
16 Correct 22 ms 3520 KB Output is correct
17 Correct 20 ms 3576 KB Output is correct
18 Correct 20 ms 3608 KB Output is correct
19 Correct 25 ms 3616 KB Output is correct
20 Correct 17 ms 3992 KB Output is correct
21 Correct 17 ms 4040 KB Output is correct
22 Correct 23 ms 3872 KB Output is correct
23 Correct 23 ms 4120 KB Output is correct
24 Correct 20 ms 4000 KB Output is correct
25 Correct 20 ms 4168 KB Output is correct
26 Correct 24 ms 4376 KB Output is correct
27 Correct 22 ms 4128 KB Output is correct
28 Correct 23 ms 4228 KB Output is correct
29 Correct 19 ms 3936 KB Output is correct
30 Correct 20 ms 4056 KB Output is correct
31 Correct 6 ms 1916 KB Output is correct
32 Correct 5 ms 1780 KB Output is correct
33 Correct 6 ms 1796 KB Output is correct
34 Correct 6 ms 2016 KB Output is correct
35 Correct 4 ms 1916 KB Output is correct
36 Correct 17 ms 1928 KB Output is correct
37 Correct 5 ms 2024 KB Output is correct
38 Correct 5 ms 1940 KB Output is correct
39 Correct 5 ms 1916 KB Output is correct
40 Correct 5 ms 1788 KB Output is correct
41 Correct 5 ms 1888 KB Output is correct
42 Correct 4 ms 2016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1912 KB Output is correct
2 Correct 5 ms 1784 KB Output is correct
3 Correct 4 ms 1716 KB Output is correct
4 Correct 7 ms 2248 KB Output is correct
5 Correct 7 ms 2104 KB Output is correct
6 Correct 7 ms 2096 KB Output is correct
7 Correct 7 ms 2104 KB Output is correct
8 Correct 7 ms 2232 KB Output is correct
9 Correct 18 ms 4528 KB Output is correct
10 Correct 18 ms 4528 KB Output is correct
11 Correct 17 ms 4404 KB Output is correct
12 Correct 4 ms 1800 KB Output is correct
13 Correct 6 ms 1780 KB Output is correct
14 Correct 4 ms 1916 KB Output is correct
15 Correct 5 ms 1780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 4952 KB Output is correct
2 Partially correct 35 ms 5144 KB Partially correct
3 Correct 35 ms 5384 KB Output is correct
4 Correct 20 ms 3868 KB Output is correct
5 Correct 22 ms 4136 KB Output is correct
6 Correct 23 ms 3788 KB Output is correct
7 Correct 22 ms 4032 KB Output is correct
8 Correct 22 ms 4016 KB Output is correct
9 Correct 20 ms 4008 KB Output is correct
10 Correct 20 ms 4276 KB Output is correct
11 Correct 20 ms 4360 KB Output is correct
12 Correct 19 ms 3460 KB Output is correct
13 Correct 20 ms 3472 KB Output is correct
14 Correct 20 ms 3628 KB Output is correct
15 Partially correct 20 ms 3868 KB Partially correct
16 Correct 20 ms 3752 KB Output is correct
17 Correct 22 ms 3868 KB Output is correct
18 Partially correct 22 ms 3752 KB Partially correct
19 Partially correct 22 ms 3864 KB Partially correct
20 Correct 17 ms 3968 KB Output is correct
21 Correct 17 ms 4020 KB Output is correct
22 Correct 23 ms 4020 KB Output is correct
23 Correct 22 ms 4008 KB Output is correct
24 Correct 22 ms 4008 KB Output is correct
25 Correct 22 ms 4136 KB Output is correct
26 Correct 22 ms 4008 KB Output is correct
27 Correct 22 ms 4136 KB Output is correct
28 Correct 23 ms 4008 KB Output is correct
29 Correct 19 ms 4092 KB Output is correct
30 Correct 20 ms 3996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 5192 KB Output is correct
2 Correct 35 ms 5144 KB Output is correct
3 Correct 35 ms 5136 KB Output is correct
4 Correct 20 ms 3632 KB Output is correct
5 Correct 25 ms 4392 KB Output is correct
6 Correct 23 ms 3880 KB Output is correct
7 Correct 23 ms 4016 KB Output is correct
8 Correct 22 ms 4144 KB Output is correct
9 Correct 22 ms 4048 KB Output is correct
10 Correct 23 ms 4280 KB Output is correct
11 Correct 22 ms 4328 KB Output is correct
12 Correct 19 ms 3480 KB Output is correct
13 Correct 19 ms 3568 KB Output is correct
14 Correct 20 ms 3484 KB Output is correct
15 Correct 20 ms 3752 KB Output is correct
16 Incorrect 22 ms 3660 KB Output isn't correct
17 Halted 0 ms 0 KB -