답안 #30012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
30012 2017-07-21T12:44:46 Z gabrielsimoes Amusement Park (JOI17_amusement_park) C++14
18 / 100
28 ms 5972 KB
#include <bits/stdc++.h>
#include "Joi.h"
using namespace std;

typedef long long ll;

void Joi(int N, int M, int A[], int B[], ll X, int T) {
	vector<bool> bits;
	while (X) {
		bits.push_back(X&1);
		X >>= 1;
	}

	reverse(bits.begin(), bits.end());

	for (int i = 0, k = 0; i < N; i++) {
		if (i+bits.size() < N) MessageBoard(i, 0);
		else MessageBoard(i, bits[k++]);
	}
}
#include <bits/stdc++.h>
#include "Ioi.h"
using namespace std;

typedef long long ll;

ll Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	vector<int> g[N];
	for (int i = 0; i < M; i++) {
		g[A[i]].push_back(B[i]);
		g[B[i]].push_back(A[i]);
	}

	vector<bool> val(N);
	vector<bool> visisted(N);

	val[P] = V;

	function<void(int)> dfs;
	dfs = [&](int cur) {
		// cout << "dfs " << cur << endl;
		visisted[cur] = true;
		for (int nx : g[cur]) {
			if (visisted[nx]) continue;
			val[nx] = Move(nx);
			dfs(nx);
			Move(cur);
		}
	};

	dfs(P);

	// for (int i = 0; i < N; i++)
	// 	cout << "val[" << i << "]: " << val[i] << endl;

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans <<= 1;
		ans |= (int) val[i];
	}

	return ans;
}

Compilation message

Joi.cpp: In function 'void Joi(int, int, int*, int*, ll, int)':
Joi.cpp:17:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (i+bits.size() < N) MessageBoard(i, 0);
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4756 KB Output is correct
2 Correct 0 ms 4756 KB Output is correct
3 Correct 0 ms 4756 KB Output is correct
4 Correct 0 ms 4756 KB Output is correct
5 Correct 0 ms 4756 KB Output is correct
6 Correct 0 ms 4756 KB Output is correct
7 Correct 0 ms 4756 KB Output is correct
8 Correct 0 ms 4756 KB Output is correct
9 Correct 0 ms 4756 KB Output is correct
10 Correct 0 ms 4756 KB Output is correct
11 Correct 3 ms 4756 KB Output is correct
12 Correct 0 ms 4756 KB Output is correct
13 Correct 0 ms 4756 KB Output is correct
14 Correct 0 ms 4756 KB Output is correct
15 Correct 0 ms 4756 KB Output is correct
16 Correct 0 ms 4756 KB Output is correct
17 Correct 0 ms 4756 KB Output is correct
18 Correct 0 ms 4756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 5816 KB Output is correct
2 Correct 25 ms 5816 KB Output is correct
3 Correct 28 ms 5820 KB Output is correct
4 Correct 6 ms 5264 KB Output is correct
5 Correct 15 ms 5972 KB Output is correct
6 Correct 15 ms 5644 KB Output is correct
7 Correct 19 ms 5612 KB Output is correct
8 Correct 16 ms 5596 KB Output is correct
9 Correct 15 ms 5512 KB Output is correct
10 Correct 15 ms 5324 KB Output is correct
11 Correct 15 ms 5324 KB Output is correct
12 Correct 9 ms 5108 KB Output is correct
13 Correct 12 ms 5112 KB Output is correct
14 Correct 15 ms 5120 KB Output is correct
15 Correct 15 ms 5264 KB Output is correct
16 Correct 15 ms 5264 KB Output is correct
17 Correct 9 ms 5260 KB Output is correct
18 Correct 15 ms 5264 KB Output is correct
19 Correct 15 ms 5264 KB Output is correct
20 Correct 15 ms 5364 KB Output is correct
21 Correct 9 ms 5360 KB Output is correct
22 Correct 15 ms 5368 KB Output is correct
23 Correct 18 ms 5364 KB Output is correct
24 Correct 15 ms 5364 KB Output is correct
25 Correct 19 ms 5364 KB Output is correct
26 Correct 18 ms 5368 KB Output is correct
27 Correct 18 ms 5368 KB Output is correct
28 Correct 19 ms 5360 KB Output is correct
29 Correct 12 ms 5320 KB Output is correct
30 Correct 12 ms 5340 KB Output is correct
31 Correct 0 ms 4756 KB Output is correct
32 Correct 0 ms 4756 KB Output is correct
33 Correct 0 ms 4756 KB Output is correct
34 Correct 0 ms 4756 KB Output is correct
35 Correct 0 ms 4756 KB Output is correct
36 Correct 0 ms 4756 KB Output is correct
37 Correct 0 ms 4756 KB Output is correct
38 Correct 0 ms 4756 KB Output is correct
39 Correct 0 ms 4756 KB Output is correct
40 Correct 0 ms 4756 KB Output is correct
41 Correct 0 ms 4756 KB Output is correct
42 Correct 0 ms 4756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4756 KB Output is correct
2 Correct 0 ms 4756 KB Output is correct
3 Correct 0 ms 4756 KB Output is correct
4 Incorrect 0 ms 4816 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 5820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 25 ms 5816 KB Output isn't correct
2 Halted 0 ms 0 KB -