답안 #293979

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293979 2020-09-08T14:14:43 Z mjkocijan Amusement Park (JOI17_amusement_park) C++14
69 / 100
61 ms 5708 KB
#include "Joi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
#define X first
#define Y second
#define pb push_back
#define MAXN 20100

namespace JOI {
	int n, m;
	int a[MAXN], b[MAXN];
	ll x;
	int t;
	vector<int> g[MAXN];
	int tt = 0;
	int bio[MAXN];
	int usao[MAXN];

	void dfs(int cv, int rod)
	{
		if (bio[cv]) return;
		bio[cv] = 1;
		for (int i: g[cv]) {
			if (rod != i) {
				dfs(i, cv);
			}
		}
		usao[cv] = tt;
		tt++;
		MessageBoard(cv, !!(x & (1LL << ll(usao[cv] % 60))));
	}
}
using namespace JOI;

void Joi(int N, int M, int A[], int B[], long long X, int T) {
	n = N; m = M; x = X; t = T;
	for(int i = 0; i < N; i++){
		//MessageBoard(i, 0);
	}
	for (int i = 0; i < m; i++) {
		a[i] = A[i];
		b[i] = B[i];
		g[a[i]].pb(b[i]);
		g[b[i]].pb(a[i]);
	}
	for (int i = 0; i < n; i++) if (i % 2 == 0) reverse(g[i].begin(), g[i].end());
	dfs(n - 1, -1);
}
#include "Ioi.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
#define X first
#define Y second
#define pb push_back
#define MAXN 20100
 
namespace IOI {
	int n, m;
	int a[MAXN], b[MAXN], par[MAXN];
	int p, v;
	int t;
	vector<int> g[MAXN];
	int tt = 0;
	int bio[MAXN];
	int usao[MAXN];
	ll reza = 0LL;
	int done[100], cnt = 0;
 
	void dfs(int cv, int rod)
	{
		if (bio[cv]) return;
		bio[cv] = 1;
		par[cv] = rod;
		for (int i: g[cv]) {
			if (rod != i) {
				dfs(i, cv);
			}
		}
		usao[cv] = tt;
		tt++;
	}
 
	void dfs2(int cv, int msg, int isrt)
	{
		bio[cv] = 1;
		
		int cu = usao[cv] % 60;
		if (!done[cu]) {
			cnt++;//cout<<cv<<' '<<usao[cv]<<'.'<<cnt<<endl;
			done[cu] = 1;
			reza |= ll(msg) * (1LL << ll(cu));
		}
		if (cnt == 60) return;
		
		for (int i: g[cv]) {
			if (i == par[cv]) continue;
			
			if (bio[i]) continue;
			
			dfs2(i, Move(i), 0);
			
			if (cnt == 60) return;
		}
		
		if (par[cv] != -1
		//&& isrt
		)
		{
			dfs2(par[cv], Move(par[cv]), 1);
		}
	}
}
using namespace IOI;
 
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	n = N; m = M; p = P; v = V; t = T;
	for (int i = 0; i < m; i++) {
		a[i] = A[i];
		b[i] = B[i];
		g[a[i]].pb(b[i]);
		g[b[i]].pb(a[i]);
	}
	for (int i = 0; i < n; i++) if (i % 2 == 0) reverse(g[i].begin(), g[i].end());
	dfs(n - 1, -1);
	memset(bio, 0, sizeof bio);
	dfs2(p, v, 1);
  //return 0LL;
  return reza;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1804 KB Output is correct
2 Correct 2 ms 1808 KB Output is correct
3 Correct 2 ms 1936 KB Output is correct
4 Correct 2 ms 1812 KB Output is correct
5 Correct 2 ms 1812 KB Output is correct
6 Correct 3 ms 1800 KB Output is correct
7 Correct 3 ms 1936 KB Output is correct
8 Correct 2 ms 1936 KB Output is correct
9 Correct 2 ms 2048 KB Output is correct
10 Correct 2 ms 1672 KB Output is correct
11 Correct 5 ms 2260 KB Output is correct
12 Correct 2 ms 2052 KB Output is correct
13 Correct 2 ms 1936 KB Output is correct
14 Correct 2 ms 1936 KB Output is correct
15 Correct 2 ms 1936 KB Output is correct
16 Correct 2 ms 1936 KB Output is correct
17 Correct 4 ms 2044 KB Output is correct
18 Correct 3 ms 1936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 5412 KB Output is correct
2 Correct 35 ms 5392 KB Output is correct
3 Correct 40 ms 5708 KB Output is correct
4 Correct 18 ms 3756 KB Output is correct
5 Correct 19 ms 4268 KB Output is correct
6 Correct 20 ms 4208 KB Output is correct
7 Correct 20 ms 4132 KB Output is correct
8 Correct 18 ms 4088 KB Output is correct
9 Correct 20 ms 4084 KB Output is correct
10 Correct 23 ms 3760 KB Output is correct
11 Correct 18 ms 3940 KB Output is correct
12 Correct 20 ms 3648 KB Output is correct
13 Correct 22 ms 3604 KB Output is correct
14 Correct 25 ms 3616 KB Output is correct
15 Correct 24 ms 3836 KB Output is correct
16 Correct 20 ms 3832 KB Output is correct
17 Correct 26 ms 3832 KB Output is correct
18 Correct 27 ms 3960 KB Output is correct
19 Correct 61 ms 3748 KB Output is correct
20 Correct 39 ms 4372 KB Output is correct
21 Correct 17 ms 4384 KB Output is correct
22 Correct 18 ms 4092 KB Output is correct
23 Correct 31 ms 4012 KB Output is correct
24 Correct 31 ms 4144 KB Output is correct
25 Correct 31 ms 4012 KB Output is correct
26 Correct 17 ms 4012 KB Output is correct
27 Correct 24 ms 4012 KB Output is correct
28 Correct 23 ms 4148 KB Output is correct
29 Correct 19 ms 3900 KB Output is correct
30 Correct 27 ms 4000 KB Output is correct
31 Correct 2 ms 1800 KB Output is correct
32 Correct 2 ms 1804 KB Output is correct
33 Correct 3 ms 1808 KB Output is correct
34 Correct 3 ms 1800 KB Output is correct
35 Correct 2 ms 1928 KB Output is correct
36 Correct 2 ms 1800 KB Output is correct
37 Correct 2 ms 1828 KB Output is correct
38 Correct 3 ms 1816 KB Output is correct
39 Correct 3 ms 1800 KB Output is correct
40 Correct 3 ms 1800 KB Output is correct
41 Correct 3 ms 1808 KB Output is correct
42 Correct 2 ms 1800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1800 KB Output is correct
2 Correct 2 ms 1672 KB Output is correct
3 Correct 2 ms 1808 KB Output is correct
4 Correct 4 ms 2396 KB Output is correct
5 Correct 5 ms 2396 KB Output is correct
6 Correct 4 ms 2392 KB Output is correct
7 Correct 4 ms 2388 KB Output is correct
8 Correct 4 ms 2396 KB Output is correct
9 Correct 16 ms 4660 KB Output is correct
10 Correct 20 ms 4672 KB Output is correct
11 Correct 16 ms 4668 KB Output is correct
12 Correct 2 ms 1808 KB Output is correct
13 Correct 2 ms 1800 KB Output is correct
14 Correct 2 ms 1800 KB Output is correct
15 Correct 2 ms 1672 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 5412 KB Output is correct
2 Correct 61 ms 5268 KB Output is correct
3 Partially correct 32 ms 5540 KB Partially correct
4 Partially correct 18 ms 3836 KB Partially correct
5 Correct 19 ms 4396 KB Output is correct
6 Partially correct 23 ms 4200 KB Partially correct
7 Partially correct 19 ms 4132 KB Partially correct
8 Partially correct 18 ms 4176 KB Partially correct
9 Partially correct 20 ms 4208 KB Partially correct
10 Correct 19 ms 3928 KB Output is correct
11 Correct 24 ms 3760 KB Output is correct
12 Partially correct 17 ms 3476 KB Partially correct
13 Correct 19 ms 3644 KB Output is correct
14 Correct 26 ms 3616 KB Output is correct
15 Partially correct 17 ms 3840 KB Partially correct
16 Partially correct 19 ms 3836 KB Partially correct
17 Partially correct 20 ms 3840 KB Partially correct
18 Partially correct 19 ms 3824 KB Partially correct
19 Correct 17 ms 3848 KB Output is correct
20 Correct 19 ms 4140 KB Output is correct
21 Correct 18 ms 4380 KB Output is correct
22 Partially correct 20 ms 4088 KB Partially correct
23 Partially correct 17 ms 4012 KB Partially correct
24 Partially correct 20 ms 4108 KB Partially correct
25 Partially correct 17 ms 4148 KB Partially correct
26 Partially correct 18 ms 4092 KB Partially correct
27 Partially correct 20 ms 4180 KB Partially correct
28 Partially correct 20 ms 3884 KB Partially correct
29 Partially correct 20 ms 3872 KB Partially correct
30 Partially correct 20 ms 4176 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 5284 KB Output isn't correct
2 Halted 0 ms 0 KB -