Submission #411859

# Submission time Handle Problem Language Result Execution time Memory
411859 2021-05-26T07:01:17 Z amoo_safar Broken Device (JOI17_broken_device) C++17
0 / 100
54 ms 2460 KB
#include "Annalib.h"

#include <bits/stdc++.h>

using namespace std;

const int Z = 75;
vector< vector<int> > V;
bool init = false;

void Init(){
	srand(time(0));
	vector<int> per = {0, 1, 2};
	for(int i = 0; i < Z; i++){
		random_shuffle(per.begin(), per.end());
		V.push_back(per);
	}
	init = true;
}

void Anna( int n, long long X, int K, int P[] ){
	if(!init)
		Init();
	vector<int> mk(n, 0);
	for(int i = 0; i < K; i++)
		mk[P[i]] = 1;
	// for(int i = 0; i < N; i++){
	// 	if(i == N - 1){
	// 		Set(i, 0);
	// 		continue;
	// 	}
	// 	if(mk[i] || mk[i + 1])
	// 		Set(i, 0);
	// }
	for(int i = 0; i < n; i += 2){
		if(mk[i] && mk[i + 1]){
			Set(i, 0);
			Set(i + 1, 0);
			continue;
		}
		int rt = X % 3;
		int idx = 0;
		for(int j = 0; j < 3; j++)
			if(V[i / 2][j] == rt)
				idx = j;
		int br = mk[i] + mk[i] + mk[i + 1];
		if(br & (idx + 1)){
			Set(i, 0);
			Set(i + 1, 0);	
			continue;
		}
		X /= 3;
		// cerr << "# " << idx << '\n';
		Set(i, (idx + 1) / 2);
		Set(i + 1, (idx + 1) % 2);
	}

	// cerr << "!! ";
	// for(int i = 0; i < 4; i++){
	// 	cerr << "(";
	// 	for(int j = 0; j < 3; j++)
	// 		cerr << V[i][j] << ",)"[j == 2];
	// 	// cerr << '\n';
	// }
	// cerr << '\n';
}
#include "Brunolib.h"

#include <bits/stdc++.h>

using namespace std;

const int Z = 75;
vector< vector<int> > V2;
bool init2 = false;

void Init2(){
	srand(time(0));
	vector<int> per = {0, 1, 2};
	for(int i = 0; i < Z; i++){
		random_shuffle(per.begin(), per.end());
		V2.push_back(per);
	}
	init2 = true;
}

long long Bruno( int n, int A[] ){
	if(!init2)
		Init2();

	long long res = 0;
	for(int i = n - 2; i >= 0; i--){
		if(A[i] == 0 && A[i + 1] == 0) continue;
		int rd = A[i] + A[i] + A[i + 1] - 1;
		rd = V2[i / 2][rd];
		res *= 3;
		res += rd;
	}
	// cerr << "!! " << res << '\n';
	// cerr << "!! ";
	// for(int i = 0; i < 4; i++){
	// 	cerr << "(";
	// 	for(int j = 0; j < 3; j++)
	// 		cerr << V2[i][j] << ",)"[j == 2];
	// 	// cerr << '\n';
	// }
	// cerr << '\n';
	return res;
}
# Verdict Execution time Memory Grader output
1 Partially correct 41 ms 2260 KB Output isn't correct - L* = 0
2 Partially correct 39 ms 2244 KB Output isn't correct - L* = 0
3 Partially correct 41 ms 2352 KB Output isn't correct - L* = 0
4 Partially correct 49 ms 2440 KB Output isn't correct - L* = 0
5 Partially correct 41 ms 2204 KB Output isn't correct - L* = 0
6 Partially correct 48 ms 2200 KB Output isn't correct - L* = 0
7 Partially correct 38 ms 2348 KB Output isn't correct - L* = 0
8 Partially correct 41 ms 2204 KB Output isn't correct - L* = 0
9 Partially correct 44 ms 2288 KB Output isn't correct - L* = 0
10 Partially correct 46 ms 2272 KB Output isn't correct - L* = 0
11 Partially correct 39 ms 2276 KB Output isn't correct - L* = 0
12 Partially correct 41 ms 2196 KB Output isn't correct - L* = 0
13 Partially correct 41 ms 2148 KB Output isn't correct - L* = 0
14 Partially correct 41 ms 2204 KB Output isn't correct - L* = 0
15 Partially correct 45 ms 2360 KB Output isn't correct - L* = 0
16 Partially correct 38 ms 2336 KB Output isn't correct - L* = 0
17 Partially correct 44 ms 2408 KB Output isn't correct - L* = 0
18 Partially correct 41 ms 2224 KB Output isn't correct - L* = 0
19 Partially correct 40 ms 2340 KB Output isn't correct - L* = 0
20 Partially correct 41 ms 2352 KB Output isn't correct - L* = 0
21 Partially correct 41 ms 2380 KB Output isn't correct - L* = 0
22 Partially correct 40 ms 2384 KB Output isn't correct - L* = 0
23 Partially correct 41 ms 2404 KB Output isn't correct - L* = 0
24 Partially correct 41 ms 2268 KB Output isn't correct - L* = 0
25 Partially correct 40 ms 2164 KB Output isn't correct - L* = 0
26 Partially correct 41 ms 2320 KB Output isn't correct - L* = 0
27 Partially correct 41 ms 2332 KB Output isn't correct - L* = 0
28 Partially correct 43 ms 2276 KB Output isn't correct - L* = 0
29 Partially correct 41 ms 2228 KB Output isn't correct - L* = 0
30 Partially correct 41 ms 2460 KB Output isn't correct - L* = 0
31 Partially correct 40 ms 2220 KB Output isn't correct - L* = 0
32 Partially correct 39 ms 2252 KB Output isn't correct - L* = 0
33 Partially correct 41 ms 2232 KB Output isn't correct - L* = 0
34 Partially correct 40 ms 2328 KB Output isn't correct - L* = 0
35 Partially correct 44 ms 2144 KB Output isn't correct - L* = 0
36 Partially correct 54 ms 2276 KB Output isn't correct - L* = 0
37 Partially correct 41 ms 2248 KB Output isn't correct - L* = 0
38 Partially correct 42 ms 2384 KB Output isn't correct - L* = 0
39 Partially correct 41 ms 2200 KB Output isn't correct - L* = 0
40 Partially correct 40 ms 2228 KB Output isn't correct - L* = 0