답안 #41795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
41795 2018-02-21T08:52:47 Z fest Amusement Park (JOI17_amusement_park) C++14
78 / 100
52 ms 20672 KB
#include "Joi.h"
// fest
#include <bits/stdc++.h>	

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define FILENAME ""
#define __ fflush(stdout)

typedef long long ll;
typedef long double ld;    

using namespace std;                           

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

static const int N = 200500, inf = 1e9 * 2, MOD = (int)1e9 + 7;

static char CH[N];

static const ll INF = 1e18;

static const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
static const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

static int in[N], timer;

static bool was[N];

static vector<int> g[N];

static void dfs(int v) {
	was[v] = 1;
	in[v] = ++timer;
	for (auto u : g[v]) {
		if (was[u]) continue;
		dfs(u);        
	}
}

void Joi(int n, int m, int A[], int B[], long long x, int T) {
	for (int i = 0; i < m; i++) {
		g[A[i]].pb(B[i]);
		g[B[i]].pb(A[i]);
	} 
	dfs(0);
	for (int i = 0; i < n; i++) {
		if ((1ll << (in[i] % 60)) & x) MessageBoard(i, 1);
		else MessageBoard(i, 0);
	}
}
#include "Ioi.h"
// fest
#include <bits/stdc++.h>	

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define FILENAME ""
#define __ fflush(stdout)

typedef long long ll;
typedef long double ld;    

using namespace std;                           

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

static const int N = 200500, inf = 1e9 * 2, MOD = (int)1e9 + 7;

static char CH[N];

static const ll INF = 1e18;

static const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1};
static const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1};

static int in[N], timer, up[N], bit[N], dont;

static bool was[N];

static vector<int> g[N];

static void dfs(int v) {
	was[v] = 1;
	in[v] = ++timer;
	for (auto u : g[v]) {
		if (was[u]) continue;
		up[u] = v;
		dfs(u);        
	}
}

static void dfs1(int v) {
	if (!dont) return;
	was[v] = 1;
	for (auto u : g[v]) {
		if (was[u]) continue;
		if (in[u] > in[v]) {
			if (bit[in[u] % 60] == -1) dont--;
			bit[in[u] % 60] = Move(u);
			dfs1(u);
			if (!dont) return;
			Move(v);
		}
	}
	assert(v > 0);
	if (was[up[v]]) return;
	if (bit[in[up[v]] % 60] == -1) dont--;
	bit[in[up[v]] % 60] = Move(up[v]);
	if (!dont) return;	
	dfs1(up[v]);
}

long long Ioi(int n, int m, int A[], int B[], int start, int msg, int T) {
	for (int i = 0; i < m; i++) g[A[i]].pb(B[i]), g[B[i]].pb(A[i]);
	dfs(0);
	for (int i = 0; i < 60; i++) bit[i] = -1;
	dont = 60;
	bit[in[start] % 60] = msg;
	dont--;
	memset(was, 0, sizeof(was));
	dfs1(start);
	ll ret = 0;
	for (int i = 0; i < 60; i++) ret |= ((bit[i] * 1ll) << i);
	return ret;
}

Compilation message

Joi.cpp:25:13: warning: 'CH' defined but not used [-Wunused-variable]
 static char CH[N];
             ^

Ioi.cpp:25:13: warning: 'CH' defined but not used [-Wunused-variable]
 static char CH[N];
             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 10468 KB Output is correct
2 Correct 11 ms 10836 KB Output is correct
3 Correct 14 ms 11024 KB Output is correct
4 Correct 12 ms 11080 KB Output is correct
5 Correct 10 ms 11080 KB Output is correct
6 Correct 10 ms 11080 KB Output is correct
7 Correct 12 ms 11080 KB Output is correct
8 Correct 11 ms 11080 KB Output is correct
9 Correct 10 ms 11080 KB Output is correct
10 Correct 10 ms 11080 KB Output is correct
11 Correct 15 ms 11236 KB Output is correct
12 Correct 11 ms 11392 KB Output is correct
13 Correct 11 ms 11392 KB Output is correct
14 Correct 10 ms 11392 KB Output is correct
15 Correct 11 ms 11392 KB Output is correct
16 Correct 12 ms 11392 KB Output is correct
17 Correct 11 ms 11392 KB Output is correct
18 Correct 11 ms 11392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 52 ms 13572 KB Output is correct
2 Correct 49 ms 13784 KB Output is correct
3 Correct 38 ms 13800 KB Output is correct
4 Correct 27 ms 13800 KB Output is correct
5 Correct 27 ms 13800 KB Output is correct
6 Correct 27 ms 13800 KB Output is correct
7 Correct 28 ms 13800 KB Output is correct
8 Correct 27 ms 13800 KB Output is correct
9 Correct 31 ms 13800 KB Output is correct
10 Correct 23 ms 13800 KB Output is correct
11 Correct 23 ms 13800 KB Output is correct
12 Correct 23 ms 13800 KB Output is correct
13 Correct 24 ms 13800 KB Output is correct
14 Correct 23 ms 13800 KB Output is correct
15 Correct 25 ms 13800 KB Output is correct
16 Correct 26 ms 13800 KB Output is correct
17 Correct 25 ms 13800 KB Output is correct
18 Correct 25 ms 13800 KB Output is correct
19 Correct 25 ms 13800 KB Output is correct
20 Correct 22 ms 13800 KB Output is correct
21 Correct 28 ms 13800 KB Output is correct
22 Correct 26 ms 13800 KB Output is correct
23 Correct 30 ms 13800 KB Output is correct
24 Correct 25 ms 13800 KB Output is correct
25 Correct 27 ms 13800 KB Output is correct
26 Correct 38 ms 13800 KB Output is correct
27 Correct 29 ms 13800 KB Output is correct
28 Correct 27 ms 13800 KB Output is correct
29 Correct 26 ms 13800 KB Output is correct
30 Correct 30 ms 13800 KB Output is correct
31 Correct 11 ms 13800 KB Output is correct
32 Correct 11 ms 13800 KB Output is correct
33 Correct 11 ms 13800 KB Output is correct
34 Correct 10 ms 13800 KB Output is correct
35 Correct 11 ms 13800 KB Output is correct
36 Correct 11 ms 13800 KB Output is correct
37 Correct 11 ms 13800 KB Output is correct
38 Correct 10 ms 13800 KB Output is correct
39 Correct 11 ms 13800 KB Output is correct
40 Correct 11 ms 13800 KB Output is correct
41 Correct 10 ms 13800 KB Output is correct
42 Correct 10 ms 13800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 13800 KB Output is correct
2 Correct 10 ms 13800 KB Output is correct
3 Correct 10 ms 13800 KB Output is correct
4 Correct 15 ms 13800 KB Output is correct
5 Correct 13 ms 13800 KB Output is correct
6 Correct 12 ms 13800 KB Output is correct
7 Correct 13 ms 13800 KB Output is correct
8 Correct 13 ms 13800 KB Output is correct
9 Correct 23 ms 13800 KB Output is correct
10 Correct 24 ms 13800 KB Output is correct
11 Correct 24 ms 13800 KB Output is correct
12 Correct 11 ms 13800 KB Output is correct
13 Correct 11 ms 13800 KB Output is correct
14 Correct 10 ms 13800 KB Output is correct
15 Correct 11 ms 13800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 13804 KB Output is correct
2 Partially correct 39 ms 14028 KB Partially correct
3 Correct 43 ms 14440 KB Output is correct
4 Correct 27 ms 14632 KB Output is correct
5 Correct 27 ms 14632 KB Output is correct
6 Correct 27 ms 14632 KB Output is correct
7 Correct 28 ms 14632 KB Output is correct
8 Correct 27 ms 14660 KB Output is correct
9 Correct 30 ms 14784 KB Output is correct
10 Correct 26 ms 14980 KB Output is correct
11 Correct 25 ms 15180 KB Output is correct
12 Correct 27 ms 15280 KB Output is correct
13 Correct 30 ms 15312 KB Output is correct
14 Correct 28 ms 15448 KB Output is correct
15 Correct 28 ms 15784 KB Output is correct
16 Correct 27 ms 16112 KB Output is correct
17 Correct 28 ms 16304 KB Output is correct
18 Partially correct 27 ms 16496 KB Partially correct
19 Correct 29 ms 16688 KB Output is correct
20 Correct 25 ms 17040 KB Output is correct
21 Correct 24 ms 17364 KB Output is correct
22 Correct 30 ms 17432 KB Output is correct
23 Correct 34 ms 17516 KB Output is correct
24 Correct 34 ms 17672 KB Output is correct
25 Correct 37 ms 17968 KB Output is correct
26 Correct 27 ms 18192 KB Output is correct
27 Correct 28 ms 18384 KB Output is correct
28 Correct 27 ms 18576 KB Output is correct
29 Correct 32 ms 18616 KB Output is correct
30 Correct 26 ms 18836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 19708 KB Output is correct
2 Correct 37 ms 20096 KB Output is correct
3 Correct 43 ms 20480 KB Output is correct
4 Incorrect 27 ms 20672 KB Output isn't correct
5 Halted 0 ms 0 KB -