Submission #715720

# Submission time Handle Problem Language Result Execution time Memory
715720 2023-03-27T16:07:31 Z valerikk Broken Device (JOI17_broken_device) C++17
85 / 100
62 ms 2720 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

void Anna( int N, long long X, int K, int P[] ){
	mt19937 rnd(239);
	vector<int> ord(N);
	iota(ord.begin(), ord.end(), 0);
	shuffle(ord.begin(), ord.end(), rnd);
	vector<int> bad(N, 0);
	for (int i = 0; i < K; ++i) {
		bad[P[i]] = 1;
	}
	vector<int> a(N, 0);
	for (int i = 0; i + 1 < N; i += 2) {
		if (!bad[ord[i]] && !bad[ord[i + 1]]) {
			if (X % 3 == 0) {
				a[ord[i]] = 1;
			}
			if (X % 3 == 1) {
				a[ord[i + 1]] = 1;
			}
			if (X % 3 == 2) {
				a[ord[i]] = a[ord[i + 1]] = 1;
			}
			X /= 3;
		}
	}
	for (int i = 0; i < N; ++i) {
		Set(i, a[i]);
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

long long Bruno( int N, int A[] ){
	mt19937 rnd(239);
	vector<int> ord(N);
	iota(ord.begin(), ord.end(), 0);
	shuffle(ord.begin(), ord.end(), rnd);
	long long X = 0;
	vector<int> digits;
	for (int i = 0; i + 1 < N; i += 2) {
		if (A[ord[i]] || A[ord[i + 1]]) {
			if (!A[ord[i + 1]]) {
				digits.push_back(0);
			}
			if (!A[ord[i]]) {
				digits.push_back(1);
			}
			if (A[ord[i]] && A[ord[i + 1]]) {
				digits.push_back(2);
			}
		}
	}
	reverse(digits.begin(), digits.end());
	for (int d : digits) {
		X = X * 3 + d;
	}
	return X;
}
# Verdict Execution time Memory Grader output
1 Partially correct 41 ms 2500 KB Output is partially correct - L* = 37
2 Partially correct 40 ms 2576 KB Output is partially correct - L* = 38
3 Partially correct 45 ms 2484 KB Output is partially correct - L* = 37
4 Partially correct 42 ms 2524 KB Output is partially correct - L* = 37
5 Partially correct 42 ms 2720 KB Output is partially correct - L* = 37
6 Partially correct 44 ms 2644 KB Output is partially correct - L* = 37
7 Partially correct 42 ms 2536 KB Output is partially correct - L* = 37
8 Partially correct 41 ms 2508 KB Output is partially correct - L* = 37
9 Partially correct 43 ms 2564 KB Output is partially correct - L* = 37
10 Partially correct 41 ms 2616 KB Output is partially correct - L* = 37
11 Partially correct 41 ms 2516 KB Output is partially correct - L* = 37
12 Partially correct 40 ms 2468 KB Output is partially correct - L* = 37
13 Partially correct 41 ms 2468 KB Output is partially correct - L* = 38
14 Partially correct 41 ms 2504 KB Output is partially correct - L* = 37
15 Partially correct 44 ms 2484 KB Output is partially correct - L* = 37
16 Partially correct 42 ms 2552 KB Output is partially correct - L* = 37
17 Partially correct 41 ms 2420 KB Output is partially correct - L* = 38
18 Partially correct 40 ms 2480 KB Output is partially correct - L* = 37
19 Partially correct 42 ms 2612 KB Output is partially correct - L* = 37
20 Partially correct 43 ms 2420 KB Output is partially correct - L* = 37
21 Partially correct 49 ms 2544 KB Output is partially correct - L* = 38
22 Partially correct 41 ms 2500 KB Output is partially correct - L* = 37
23 Partially correct 46 ms 2500 KB Output is partially correct - L* = 37
24 Partially correct 45 ms 2608 KB Output is partially correct - L* = 38
25 Partially correct 42 ms 2560 KB Output is partially correct - L* = 37
26 Partially correct 45 ms 2460 KB Output is partially correct - L* = 37
27 Partially correct 40 ms 2624 KB Output is partially correct - L* = 38
28 Partially correct 42 ms 2504 KB Output is partially correct - L* = 37
29 Partially correct 52 ms 2564 KB Output is partially correct - L* = 37
30 Partially correct 46 ms 2484 KB Output is partially correct - L* = 37
31 Partially correct 42 ms 2568 KB Output is partially correct - L* = 37
32 Partially correct 43 ms 2668 KB Output is partially correct - L* = 37
33 Partially correct 46 ms 2644 KB Output is partially correct - L* = 37
34 Partially correct 62 ms 2396 KB Output is partially correct - L* = 37
35 Partially correct 44 ms 2520 KB Output is partially correct - L* = 37
36 Partially correct 41 ms 2520 KB Output is partially correct - L* = 37
37 Partially correct 42 ms 2412 KB Output is partially correct - L* = 37
38 Partially correct 41 ms 2548 KB Output is partially correct - L* = 37
39 Partially correct 43 ms 2504 KB Output is partially correct - L* = 39
40 Partially correct 50 ms 2544 KB Output is partially correct - L* = 37