답안 #837223

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
837223 2023-08-25T08:22:40 Z TranGiaHuy1508 Broken Device (JOI17_broken_device) C++17
0 / 100
35 ms 2800 KB
#include <bits/stdc++.h>
using namespace std;

#include "Annalib.h"

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

namespace {
	ll SEED = 123456789;
	mt19937_64 rng(SEED);

	bool init = false;
	vector<vvi> mapping;

	void generate(){
		if (init) return;
		init = true;

		vvi M = {{1, 6}, {2, 5}, {3, 4}, {7}};
		for (int i = 0; i < 50; i++){
			vvi _M = M;
			shuffle(_M.begin(), _M.end(), rng);
			mapping.push_back(_M);
		}
	}
}

void Anna(int N, ll X, int K, int P[]){
	generate();

	vector<int> broken(N, 0);
	for (int i = 0; i < K; i++) broken[P[i]] = 1;

	for (int i = 0; i < N; i += 3){
		vector<int> S(3);
		iota(S.begin(), S.end(), i);

		int valid = 7;
		for (int j = 0; j < 3; j++){
			if (broken[S[j]]) valid ^= (1 << j);
		}

		int ed = X & 3;
		int R = 0;
		for (auto mask: mapping[i/3][ed]){
			if ((valid & mask) == mask) R = mask;
		}

		for (int j = 0; j < 3; j++){
			Set(S[j], (R >> j) & 1);
		}

		if (R > 0) X >>= 2;
	}
}
#include <bits/stdc++.h>
using namespace std;

#include "Brunolib.h"

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

namespace {
	ll SEED = 123456789;
	mt19937_64 rng(SEED);

	bool init = false;
	vector<vvi> mapping;

	void generate(){
		if (init) return;
		init = true;

		vvi M = {{1, 6}, {2, 5}, {3, 4}, {7}};
		for (int i = 0; i < 50; i++){
			vvi _M = M;
			shuffle(_M.begin(), _M.end(), rng);
			mapping.push_back(_M);
		}
	}
}

ll Bruno(int N, int A[]){
	generate();

	ll answer = 0;
	for (int i = N-2; i >= 0; i -= 3){
		vector<int> S(3);
		iota(S.begin(), S.end(), i);

		int repr = 0;
		for (int j = 0; j < 3; j++){
			repr += (A[S[j]] << j);
		}

		int value = -1;
		for (int j = 0; j < 4; j++){
			for (auto k: mapping[i/3][j]){
				if (repr == k) value = j;
			}
		}

		if (value >= 0) answer = (answer << 2) + value;
	}

	return answer;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 28 ms 2612 KB Output isn't correct - L* = 0
2 Partially correct 29 ms 2740 KB Output isn't correct - L* = 0
3 Partially correct 35 ms 2548 KB Output isn't correct - L* = 0
4 Partially correct 29 ms 2548 KB Output isn't correct - L* = 0
5 Partially correct 35 ms 2692 KB Output isn't correct - L* = 0
6 Partially correct 28 ms 2704 KB Output isn't correct - L* = 0
7 Partially correct 30 ms 2600 KB Output isn't correct - L* = 0
8 Partially correct 35 ms 2632 KB Output isn't correct - L* = 0
9 Partially correct 29 ms 2632 KB Output isn't correct - L* = 0
10 Partially correct 34 ms 2640 KB Output isn't correct - L* = 0
11 Partially correct 28 ms 2592 KB Output isn't correct - L* = 0
12 Partially correct 28 ms 2548 KB Output isn't correct - L* = 0
13 Partially correct 30 ms 2764 KB Output isn't correct - L* = 0
14 Partially correct 33 ms 2720 KB Output isn't correct - L* = 0
15 Partially correct 34 ms 2592 KB Output isn't correct - L* = 0
16 Partially correct 27 ms 2672 KB Output isn't correct - L* = 0
17 Partially correct 28 ms 2620 KB Output isn't correct - L* = 0
18 Partially correct 34 ms 2648 KB Output isn't correct - L* = 0
19 Partially correct 29 ms 2580 KB Output isn't correct - L* = 0
20 Partially correct 28 ms 2640 KB Output isn't correct - L* = 0
21 Partially correct 33 ms 2664 KB Output isn't correct - L* = 0
22 Partially correct 29 ms 2708 KB Output isn't correct - L* = 0
23 Partially correct 28 ms 2756 KB Output isn't correct - L* = 0
24 Partially correct 27 ms 2600 KB Output isn't correct - L* = 0
25 Partially correct 29 ms 2684 KB Output isn't correct - L* = 0
26 Partially correct 30 ms 2800 KB Output isn't correct - L* = 0
27 Partially correct 29 ms 2668 KB Output isn't correct - L* = 0
28 Partially correct 29 ms 2624 KB Output isn't correct - L* = 0
29 Partially correct 29 ms 2584 KB Output isn't correct - L* = 0
30 Partially correct 29 ms 2684 KB Output isn't correct - L* = 0
31 Partially correct 28 ms 2664 KB Output isn't correct - L* = 0
32 Partially correct 28 ms 2740 KB Output isn't correct - L* = 0
33 Partially correct 31 ms 2652 KB Output isn't correct - L* = 0
34 Partially correct 28 ms 2692 KB Output isn't correct - L* = 0
35 Partially correct 28 ms 2764 KB Output isn't correct - L* = 0
36 Partially correct 29 ms 2648 KB Output isn't correct - L* = 0
37 Partially correct 29 ms 2708 KB Output isn't correct - L* = 0
38 Partially correct 29 ms 2760 KB Output isn't correct - L* = 0
39 Partially correct 28 ms 2672 KB Output isn't correct - L* = 0
40 Partially correct 28 ms 2732 KB Output isn't correct - L* = 0