Submission #983424

# Submission time Handle Problem Language Result Execution time Memory
983424 2024-05-15T12:17:29 Z AmirAli_H1 Broken Device (JOI17_broken_device) C++17
47 / 100
94 ms 3184 KB
// In the name of Allah

#include <bits/stdc++.h>
#include "Annalib.h"
using namespace std;

typedef		long long int			ll;
typedef		long double				ld;
typedef		pair<int, int>			pii;
typedef		pair<ll, ll>			pll;
typedef		complex<ld>				cld;

#define		all(x)					(x).begin(),(x).end()
#define		len(x)					((ll) (x).size())
#define		F						first
#define		S						second
#define		pb						push_back
#define		sep						' '
#define		endl					'\n'
#define		Mp						make_pair
#define		kill(x)					cout << x << '\n', exit(0)
#define		set_dec(x)				cout << fixed << setprecision(x);
#define		file_io(x,y)			freopen(x, "r", stdin); freopen(y, "w", stdout);

static mt19937 rng(323);

static int n, k; ll x;
static const int maxn = 150 + 4;
static const int maxlg = 60;
static int A[maxn], M[maxn];

void Anna(int nx, ll valx, int kx, int p[]) {
	n = nx; k = kx; x = valx;
	
	fill(M, M + n, 0);
	for (int i = 0; i < k; i++) M[p[i]] = 1;
	
	for (int i = 0; i < n; i++) {
		int j = rng() % (i + 1);
		for (int r = 0; r < i; r++) {
			if (A[r] >= j) A[r]++;
		}
		A[i] = j;
	}
	
	int j = 0;
	for (int i = 1; i < n; i += 2) {
		int j1 = A[i - 1], j2 = A[i];
		if (j >= maxlg) {
			Set(j1, 0); Set(j2, 0);
		}
		else {
			if (x & (1ll << j)) {
				if (M[j1]) {
					Set(j1, 0); Set(j2, 0);
				}
				else {
					Set(j1, 1); Set(j2, 0);
					j++;
				}
			}
			else {
				if (M[j2]) {
					Set(j1, 0); Set(j2, 0);
				}
				else {
					Set(j1, 0); Set(j2, 1);
					j++;
				}
			}
		}
	}
	if (n % 2 == 1) Set(A[n - 1], 0);
}
// In the name of Allah

#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;

typedef		long long int			ll;
typedef		long double				ld;
typedef		pair<int, int>			pii;
typedef		pair<ll, ll>			pll;
typedef		complex<ld>				cld;

#define		all(x)					(x).begin(),(x).end()
#define		len(x)					((ll) (x).size())
#define		F						first
#define		S						second
#define		pb						push_back
#define		sep						' '
#define		endl					'\n'
#define		Mp						make_pair
#define		kill(x)					cout << x << '\n', exit(0)
#define		set_dec(x)				cout << fixed << setprecision(x);
#define		file_io(x,y)			freopen(x, "r", stdin); freopen(y, "w", stdout);

static mt19937 rng(323);

static int n;
static const int maxn = 150 + 4;
static const int maxlg = 60;
static int A[maxn], val[maxn];

ll Bruno(int nx, int a[]) {
	n = nx;
	for (int i = 0; i < n; i++) val[i] = a[i];
	
	for (int i = 0; i < n; i++) {
		int j = rng() % (i + 1);
		for (int r = 0; r < i; r++) {
			if (A[r] >= j) A[r]++;
		}
		A[i] = j;
	}
	
	int j = 0; ll res = 0;
	for (int i = 1; i < n; i += 2) {
		int j1 = A[i - 1], j2 = A[i];
		if (val[j1] != 0) {
			res ^= (1ll << j);
			j++;
		}
		else if (val[j2] != 0) {
			j++;
		}
	}
	
	return res;
}
# Verdict Execution time Memory Grader output
1 Partially correct 81 ms 2596 KB Output is partially correct - L* = 21
2 Partially correct 82 ms 2724 KB Output is partially correct - L* = 22
3 Partially correct 81 ms 2672 KB Output is partially correct - L* = 24
4 Partially correct 81 ms 2680 KB Output is partially correct - L* = 22
5 Partially correct 84 ms 2772 KB Output is partially correct - L* = 24
6 Partially correct 81 ms 2596 KB Output is partially correct - L* = 24
7 Partially correct 83 ms 2644 KB Output is partially correct - L* = 23
8 Partially correct 84 ms 2680 KB Output is partially correct - L* = 27
9 Partially correct 94 ms 2680 KB Output is partially correct - L* = 24
10 Partially correct 82 ms 2680 KB Output is partially correct - L* = 24
11 Partially correct 82 ms 2684 KB Output is partially correct - L* = 24
12 Partially correct 92 ms 2720 KB Output is partially correct - L* = 23
13 Partially correct 81 ms 2668 KB Output is partially correct - L* = 22
14 Partially correct 88 ms 2776 KB Output is partially correct - L* = 23
15 Partially correct 82 ms 2676 KB Output is partially correct - L* = 24
16 Partially correct 88 ms 2684 KB Output is partially correct - L* = 21
17 Partially correct 83 ms 2676 KB Output is partially correct - L* = 22
18 Partially correct 82 ms 2744 KB Output is partially correct - L* = 25
19 Partially correct 90 ms 3104 KB Output is partially correct - L* = 21
20 Partially correct 90 ms 2760 KB Output is partially correct - L* = 22
21 Partially correct 84 ms 3184 KB Output is partially correct - L* = 24
22 Partially correct 81 ms 2768 KB Output is partially correct - L* = 21
23 Partially correct 81 ms 2672 KB Output is partially correct - L* = 24
24 Partially correct 88 ms 2676 KB Output is partially correct - L* = 27
25 Partially correct 82 ms 2684 KB Output is partially correct - L* = 22
26 Partially correct 81 ms 2796 KB Output is partially correct - L* = 22
27 Partially correct 82 ms 2632 KB Output is partially correct - L* = 20
28 Partially correct 91 ms 2784 KB Output is partially correct - L* = 23
29 Partially correct 81 ms 2716 KB Output is partially correct - L* = 22
30 Partially correct 86 ms 2784 KB Output is partially correct - L* = 22
31 Partially correct 81 ms 2772 KB Output is partially correct - L* = 22
32 Partially correct 87 ms 2808 KB Output is partially correct - L* = 20
33 Partially correct 81 ms 2672 KB Output is partially correct - L* = 21
34 Partially correct 82 ms 2692 KB Output is partially correct - L* = 22
35 Partially correct 81 ms 2700 KB Output is partially correct - L* = 26
36 Partially correct 88 ms 2844 KB Output is partially correct - L* = 25
37 Partially correct 81 ms 2680 KB Output is partially correct - L* = 20
38 Partially correct 82 ms 2752 KB Output is partially correct - L* = 22
39 Partially correct 91 ms 2764 KB Output is partially correct - L* = 18
40 Partially correct 94 ms 2604 KB Output is partially correct - L* = 25