답안 #647940

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647940 2022-10-04T16:46:17 Z rainboy Broken Device 2 (JOI22_device2) C++17
40 / 100
568 ms 24868 KB
/* https://www.ioi-jp.org/camp/2022/2022-sp-tasks/contest3/device2-review.pdf */
#include "Anna.h"
#include <vector>

using namespace std;

const int L = 2000;

typedef vector<int> vi;

namespace {
	long long f(int l) {
		return (long long) (l / 3 + 1) * ((l + 1) / 3 + 1) * ((l + 2) / 3 * 2 + 1);
	}
}

int Declare() {
	return L;
}

pair<vi, vi> Anna(long long x) {
	x--;
	int l = 1;
	while (x >= f(l))
		x -= f(l++);
	vi aa(l, 0), bb(l, 0);
	int l0 = l / 3, l1 = (l + 1) / 3, l2 = (l + 2) / 3;
	int kl = x % (l0 + 1), kr = x / (l0 + 1) % (l1 + 1), km = x / (l0 + 1) / (l1 + 1);
	for (int i = 0; i < kl; i++)
		aa[i] = bb[l0 - 1 - i] = 1;
	for (int i = l - 1; i >= l - kr; i--)
		aa[i] = bb[l - l1 + l - 1 - i] = 1;
	if (km <= l2)
		for (int i = 0; i < km; i++)
			aa[l0 + i] = 1;
	else {
		for (int i = 0; i < l2; i++)
			aa[l0 + i] = 1;
		for (int i = 0; i < km - l2; i++)
			bb[l0 + i] = 1;
	}
	return make_pair(aa, bb);
}
/* https://www.ioi-jp.org/camp/2022/2022-sp-tasks/contest3/device2-review.pdf */
#include "Bruno.h"
#include <vector>

using namespace std;

typedef vector<int> vi;

namespace {
	long long f(int l) {
		return (long long) (l / 3 + 1) * ((l + 1) / 3 + 1) * ((l + 2) / 3 * 2 + 1);
	}
}

long long Bruno(vi cc) {
	int l = cc.size() / 2;
	long long x = 1;
	for (int l_ = 1; l_ < l; l_++)
		x += f(l_);
	int l0 = l / 3;
	int l1 = (l + 1) / 3;
	int kl = 0;
	for (int i = 0; i < l0; i++)
		if (cc[i] == 1)
			kl++;
	int kr = 0;
	for (int i = l * 2 - 1; i >= l * 2 - l1; i--)
		if (cc[i] == 1)
			kr++;
	int km = 0;
	for (int i = 0; i < l * 2; i++)
		if (cc[i] == 1)
			km++;
	km -= (kl + kr) * 2;
	return x + ((long long) km * (l1 + 1) + kr) * (l0 + 1) + kl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 11 ms 772 KB Output is correct
3 Correct 13 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 11 ms 772 KB Output is correct
3 Correct 13 ms 768 KB Output is correct
4 Correct 44 ms 2236 KB Output is correct
5 Correct 44 ms 2236 KB Output is correct
6 Correct 45 ms 2192 KB Output is correct
7 Correct 41 ms 2256 KB Output is correct
8 Correct 43 ms 2212 KB Output is correct
9 Correct 52 ms 2520 KB Output is correct
10 Correct 47 ms 2420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 11 ms 772 KB Output is correct
3 Correct 13 ms 768 KB Output is correct
4 Correct 44 ms 2236 KB Output is correct
5 Correct 44 ms 2236 KB Output is correct
6 Correct 45 ms 2192 KB Output is correct
7 Correct 41 ms 2256 KB Output is correct
8 Correct 43 ms 2212 KB Output is correct
9 Correct 52 ms 2520 KB Output is correct
10 Correct 47 ms 2420 KB Output is correct
11 Correct 53 ms 2684 KB Output is correct
12 Correct 53 ms 2656 KB Output is correct
13 Correct 56 ms 2588 KB Output is correct
14 Correct 58 ms 2548 KB Output is correct
15 Correct 55 ms 2608 KB Output is correct
16 Correct 60 ms 2920 KB Output is correct
17 Correct 61 ms 2928 KB Output is correct
18 Correct 41 ms 2224 KB Output is correct
19 Correct 43 ms 2284 KB Output is correct
20 Correct 46 ms 2204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 11 ms 772 KB Output is correct
3 Correct 13 ms 768 KB Output is correct
4 Correct 44 ms 2236 KB Output is correct
5 Correct 44 ms 2236 KB Output is correct
6 Correct 45 ms 2192 KB Output is correct
7 Correct 41 ms 2256 KB Output is correct
8 Correct 43 ms 2212 KB Output is correct
9 Correct 52 ms 2520 KB Output is correct
10 Correct 47 ms 2420 KB Output is correct
11 Correct 53 ms 2684 KB Output is correct
12 Correct 53 ms 2656 KB Output is correct
13 Correct 56 ms 2588 KB Output is correct
14 Correct 58 ms 2548 KB Output is correct
15 Correct 55 ms 2608 KB Output is correct
16 Correct 60 ms 2920 KB Output is correct
17 Correct 61 ms 2928 KB Output is correct
18 Correct 41 ms 2224 KB Output is correct
19 Correct 43 ms 2284 KB Output is correct
20 Correct 46 ms 2204 KB Output is correct
21 Correct 89 ms 4264 KB Output is correct
22 Correct 90 ms 4344 KB Output is correct
23 Correct 90 ms 4124 KB Output is correct
24 Correct 88 ms 4252 KB Output is correct
25 Correct 89 ms 4260 KB Output is correct
26 Correct 102 ms 4812 KB Output is correct
27 Correct 93 ms 4732 KB Output is correct
28 Correct 67 ms 3252 KB Output is correct
29 Correct 68 ms 3328 KB Output is correct
30 Correct 71 ms 3532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 512 KB Output is correct
2 Correct 11 ms 772 KB Output is correct
3 Correct 13 ms 768 KB Output is correct
4 Correct 44 ms 2236 KB Output is correct
5 Correct 44 ms 2236 KB Output is correct
6 Correct 45 ms 2192 KB Output is correct
7 Correct 41 ms 2256 KB Output is correct
8 Correct 43 ms 2212 KB Output is correct
9 Correct 52 ms 2520 KB Output is correct
10 Correct 47 ms 2420 KB Output is correct
11 Correct 53 ms 2684 KB Output is correct
12 Correct 53 ms 2656 KB Output is correct
13 Correct 56 ms 2588 KB Output is correct
14 Correct 58 ms 2548 KB Output is correct
15 Correct 55 ms 2608 KB Output is correct
16 Correct 60 ms 2920 KB Output is correct
17 Correct 61 ms 2928 KB Output is correct
18 Correct 41 ms 2224 KB Output is correct
19 Correct 43 ms 2284 KB Output is correct
20 Correct 46 ms 2204 KB Output is correct
21 Correct 89 ms 4264 KB Output is correct
22 Correct 90 ms 4344 KB Output is correct
23 Correct 90 ms 4124 KB Output is correct
24 Correct 88 ms 4252 KB Output is correct
25 Correct 89 ms 4260 KB Output is correct
26 Correct 102 ms 4812 KB Output is correct
27 Correct 93 ms 4732 KB Output is correct
28 Correct 67 ms 3252 KB Output is correct
29 Correct 68 ms 3328 KB Output is correct
30 Correct 71 ms 3532 KB Output is correct
31 Correct 474 ms 20056 KB Output is correct
32 Correct 449 ms 20132 KB Output is correct
33 Correct 499 ms 20080 KB Output is correct
34 Correct 453 ms 20180 KB Output is correct
35 Correct 449 ms 20240 KB Output is correct
36 Correct 562 ms 24868 KB Output is correct
37 Correct 568 ms 24692 KB Output is correct
38 Correct 339 ms 15332 KB Output is correct
39 Correct 348 ms 15388 KB Output is correct
40 Correct 377 ms 15392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1552 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -