Submission #923990

# Submission time Handle Problem Language Result Execution time Memory
923990 2024-02-08T07:59:42 Z daoquanglinh2007 Broken Device (JOI17_broken_device) C++17
100 / 100
31 ms 2884 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

const int g[] = {45, 39, 34, 16, 24, 55, 54, 63, 19, 44, 41, 70, 61, 29, 57, 12, 72, 53, 42, 69, 48, 15, 11, 28, 66, 50, 17, 62, 58, 74, 35, 9, 68, 30, 45, 21, 47, 23, 5, 67, 41, 12, 14, 6, 17, 22, 47, 27, 49, 43, 37, 5, 20, 0, 73, 22, 11, 57, 52, 72, 63, 62, 54, 74, 13, 26, 73, 7, 31, 64, 66, 33, 30, 10, 37, 28, 64, 2, 56, 51, 53, 50, 25, 52, 71, 27, 32, 1, 7, 16, 20, 56, 71, 65, 58, 24, 3, 42, 67, 65, 38, 36, 55, 8, 10, 29, 0, 14, 46, 25, 6, 34, 43, 39, 4, 46, 15, 19, 2, 44, 32, 59, 18, 38, 59, 33, 61, 4, 8, 40, 9, 21, 31, 60, 51, 40, 1, 48, 68, 23, 36, 18, 26, 13, 3, 35, 70, 49, 69, 60};

int f[75][2], cur[75];
bool block[150], ok[150];

void Anna(int N, long long X, int K, int P[]){
	memset(cur, 0, sizeof(cur));
	for (int i = 0; i < 150; i++){
		f[g[i]][cur[g[i]]] = i;
		cur[g[i]]++;
	}
	memset(block, 0, sizeof(block));
	memset(ok, 0, sizeof(ok));
	for (int i = 0; i < K; i++) block[P[i]] = 1;
	for (int i = 0; i < 75; i++){
		if (X == 0) continue;
		int a = X%3+1, b = 0;
		if (!block[f[i][0]]) b++;
		if (!block[f[i][1]]) b += 2;
		if ((a&b) == a){
			Set(f[i][0], a&1);
			Set(f[i][1], (a&2)>>1);
			ok[f[i][0]] = 1;
			ok[f[i][1]] = 1;
			X /= 3;
		}
	}
	for (int i = 0; i < N; i++)
		if (!ok[i]) Set(i, 0);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

const int g2[] = {45, 39, 34, 16, 24, 55, 54, 63, 19, 44, 41, 70, 61, 29, 57, 12, 72, 53, 42, 69, 48, 15, 11, 28, 66, 50, 17, 62, 58, 74, 35, 9, 68, 30, 45, 21, 47, 23, 5, 67, 41, 12, 14, 6, 17, 22, 47, 27, 49, 43, 37, 5, 20, 0, 73, 22, 11, 57, 52, 72, 63, 62, 54, 74, 13, 26, 73, 7, 31, 64, 66, 33, 30, 10, 37, 28, 64, 2, 56, 51, 53, 50, 25, 52, 71, 27, 32, 1, 7, 16, 20, 56, 71, 65, 58, 24, 3, 42, 67, 65, 38, 36, 55, 8, 10, 29, 0, 14, 46, 25, 6, 34, 43, 39, 4, 46, 15, 19, 2, 44, 32, 59, 18, 38, 59, 33, 61, 4, 8, 40, 9, 21, 31, 60, 51, 40, 1, 48, 68, 23, 36, 18, 26, 13, 3, 35, 70, 49, 69, 60};

int f2[75][2], cur2[75];

long long Bruno(int N, int A[]){
	memset(cur2, 0, sizeof(cur2));
	for (int i = 0; i < 150; i++){
		f2[g2[i]][cur2[g2[i]]] = i;
		cur2[g2[i]]++;
	}
	long long X = 0;
	for (int i = 74; i >= 0; i--){
		if (A[f2[i][0]] == 0 && A[f2[i][1]] == 0) continue;
		int tmp = A[f2[i][0]]+A[f2[i][1]]*2-1;
		X = X*3+tmp;
	}
	return X;
}
# Verdict Execution time Memory Grader output
1 Correct 31 ms 2308 KB Output is correct - L* = 40
2 Correct 25 ms 2488 KB Output is correct - L* = 40
3 Correct 25 ms 2504 KB Output is correct - L* = 40
4 Correct 25 ms 2596 KB Output is correct - L* = 40
5 Correct 25 ms 2392 KB Output is correct - L* = 40
6 Correct 27 ms 2396 KB Output is correct - L* = 40
7 Correct 27 ms 2512 KB Output is correct - L* = 40
8 Correct 25 ms 2408 KB Output is correct - L* = 40
9 Correct 25 ms 2396 KB Output is correct - L* = 40
10 Correct 25 ms 2404 KB Output is correct - L* = 40
11 Correct 27 ms 2660 KB Output is correct - L* = 40
12 Correct 25 ms 2396 KB Output is correct - L* = 40
13 Correct 25 ms 2396 KB Output is correct - L* = 40
14 Correct 25 ms 2400 KB Output is correct - L* = 40
15 Correct 25 ms 2396 KB Output is correct - L* = 40
16 Correct 26 ms 2644 KB Output is correct - L* = 40
17 Correct 25 ms 2396 KB Output is correct - L* = 40
18 Correct 25 ms 2616 KB Output is correct - L* = 40
19 Correct 25 ms 2396 KB Output is correct - L* = 40
20 Correct 25 ms 2304 KB Output is correct - L* = 40
21 Correct 27 ms 2392 KB Output is correct - L* = 40
22 Correct 25 ms 2864 KB Output is correct - L* = 40
23 Correct 27 ms 2388 KB Output is correct - L* = 40
24 Correct 25 ms 2396 KB Output is correct - L* = 40
25 Correct 25 ms 2404 KB Output is correct - L* = 40
26 Correct 25 ms 2400 KB Output is correct - L* = 40
27 Correct 27 ms 2600 KB Output is correct - L* = 40
28 Correct 25 ms 2396 KB Output is correct - L* = 40
29 Correct 25 ms 2404 KB Output is correct - L* = 40
30 Correct 25 ms 2496 KB Output is correct - L* = 40
31 Correct 28 ms 2884 KB Output is correct - L* = 40
32 Correct 25 ms 2420 KB Output is correct - L* = 40
33 Correct 27 ms 2372 KB Output is correct - L* = 40
34 Correct 25 ms 2496 KB Output is correct - L* = 40
35 Correct 25 ms 2396 KB Output is correct - L* = 40
36 Correct 26 ms 2460 KB Output is correct - L* = 40
37 Correct 25 ms 2400 KB Output is correct - L* = 40
38 Correct 25 ms 2396 KB Output is correct - L* = 40
39 Correct 27 ms 2392 KB Output is correct - L* = 40
40 Correct 25 ms 2496 KB Output is correct - L* = 40