답안 #205551

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
205551 2020-02-29T07:52:10 Z ArshiaDadras Amusement Park (JOI17_amusement_park) C++14
18 / 100
40 ms 4848 KB
/* In the name of Allah */
#include<bits/stdc++.h>
#include<Joi.h>
using namespace std;

const int N = 1e4 + 5;
vector<int> adj[N], V;
bool mark[N];

void dfs(int u) {
	sort(adj[u].begin(), adj[u].end());
	mark[u] = true, V.push_back(u);
	for (auto v: adj[u])
		if (!mark[v])
			dfs(v);
}

void Joi(int n, int m, int a[], int b[], long long x, int t) {
	for (int i = 0; i < m; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	dfs(0);
	for (int i = 0; i < n; i++)
		MessageBoard(V[i], i < 60? x >> i & 1: 0);
}
/* In the name of Allah */
#include<bits/stdc++.h>
#include<Ioi.h>
using namespace std;

const int N = 1e4 + 5;
vector<int> adj[N], V;
long long answer;
bool mark[N];

bool go(int u) {
	mark[u] = true;
	if (!u)
		return true;
	for (auto v: adj[u])
		if (!mark[v] && go(v)) {
			V.push_back(v);
			return true;
		}
	return false;
}

void dfs(int u, long long b) {
	static int id = 0;
	mark[u] = true;
	if (id >= 60)
		return;
	answer |= b << id++;
	sort(adj[u].begin(), adj[u].end());
	for (auto v: adj[u])
		if (!mark[v]) {
			dfs(v, Move(v));
			Move(u);
		}
}

long long Ioi(int n, int m, int a[], int b[], int p, int v, int t) {
	for (int i = 0; i < m; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	go(p), reverse(V.begin(), V.end());
	for (auto u: V)
		v = Move(p = u);
	memset(mark, false, sizeof mark), dfs(p, v);
	return answer;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1276 KB Output is correct
2 Correct 10 ms 1272 KB Output is correct
3 Correct 10 ms 1508 KB Output is correct
4 Correct 10 ms 1280 KB Output is correct
5 Correct 10 ms 1400 KB Output is correct
6 Correct 10 ms 1524 KB Output is correct
7 Correct 10 ms 1508 KB Output is correct
8 Correct 10 ms 1520 KB Output is correct
9 Correct 10 ms 1500 KB Output is correct
10 Correct 10 ms 1520 KB Output is correct
11 Correct 15 ms 1748 KB Output is correct
12 Correct 10 ms 1296 KB Output is correct
13 Correct 10 ms 1520 KB Output is correct
14 Correct 10 ms 1408 KB Output is correct
15 Correct 10 ms 1512 KB Output is correct
16 Correct 10 ms 1408 KB Output is correct
17 Correct 10 ms 1408 KB Output is correct
18 Correct 10 ms 1504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 4764 KB Output is correct
2 Correct 40 ms 4756 KB Output is correct
3 Correct 39 ms 4592 KB Output is correct
4 Correct 33 ms 3208 KB Output is correct
5 Correct 28 ms 3860 KB Output is correct
6 Correct 27 ms 3428 KB Output is correct
7 Correct 26 ms 3576 KB Output is correct
8 Correct 26 ms 3312 KB Output is correct
9 Correct 33 ms 3388 KB Output is correct
10 Correct 27 ms 3108 KB Output is correct
11 Correct 28 ms 3160 KB Output is correct
12 Correct 28 ms 2908 KB Output is correct
13 Correct 25 ms 2972 KB Output is correct
14 Correct 24 ms 2976 KB Output is correct
15 Correct 28 ms 3148 KB Output is correct
16 Correct 26 ms 3056 KB Output is correct
17 Correct 27 ms 3124 KB Output is correct
18 Correct 26 ms 3088 KB Output is correct
19 Correct 26 ms 3128 KB Output is correct
20 Correct 27 ms 3544 KB Output is correct
21 Correct 23 ms 3372 KB Output is correct
22 Correct 27 ms 3312 KB Output is correct
23 Correct 26 ms 3320 KB Output is correct
24 Correct 25 ms 3464 KB Output is correct
25 Correct 27 ms 3440 KB Output is correct
26 Correct 27 ms 3312 KB Output is correct
27 Correct 26 ms 3312 KB Output is correct
28 Correct 27 ms 3384 KB Output is correct
29 Correct 25 ms 3196 KB Output is correct
30 Correct 25 ms 3352 KB Output is correct
31 Correct 10 ms 1272 KB Output is correct
32 Correct 10 ms 1400 KB Output is correct
33 Correct 10 ms 1352 KB Output is correct
34 Correct 11 ms 1532 KB Output is correct
35 Correct 11 ms 1284 KB Output is correct
36 Correct 10 ms 1384 KB Output is correct
37 Correct 11 ms 1276 KB Output is correct
38 Correct 10 ms 1512 KB Output is correct
39 Correct 10 ms 1280 KB Output is correct
40 Correct 10 ms 1284 KB Output is correct
41 Correct 10 ms 1280 KB Output is correct
42 Correct 10 ms 1272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1272 KB Output is correct
2 Correct 11 ms 1272 KB Output is correct
3 Correct 10 ms 1276 KB Output is correct
4 Correct 12 ms 1856 KB Output is correct
5 Incorrect 12 ms 1756 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 4756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 4848 KB Output isn't correct
2 Halted 0 ms 0 KB -