Submission #113462

# Submission time Handle Problem Language Result Execution time Memory
113462 2019-05-25T16:20:16 Z tincamatei Broken Device (JOI17_broken_device) C++14
0 / 100
7 ms 1024 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 150;

bool broken[MAX_N];
int perm[MAX_N];

void makePseudoPerm() {
	srand(269696969);
	for(int i = 0; i < MAX_N; ++i)
		perm[i] = i;
	
	random_shuffle(perm, perm + MAX_N);
}

void Anna(int N, long long X, int k, int P[]) {
	makePseudoPerm();
	for(int i = 0; i < k; ++i)
		broken[P[i]] = true;
	for(int i = 0; i < 62; ++i)
		Set(perm[i], ((1LL << i) & X) > 0);

	for(int i = 62; i < N - 62 - 1; ++i) {
		bool ok = true;
		if(!broken[perm[i]]) {
			for(int j = 0; j < 62; ++j)
				if(broken[perm[j]] && broken[perm[i + j + 1]])
					ok = false;
		
			if(ok) {
				Set(perm[i], true);
				for(int j = 0; j < 62; ++j)
					Set(perm[i + j + 1], ((1LL << j) & X) > 0);
				for(int j = i + 63; j < N; ++j)
					Set(perm[j], false);
				return;
			} else
				Set(perm[i], false);
		}
	}

	assert(false); // This should not happen
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 150;

static int perm[MAX_N];

static void makePseudoPerm() {
	srand(269696969);
	for(int i = 0; i < MAX_N; ++i)
		perm[i] = i;
	
	random_shuffle(perm, perm + MAX_N);
}

long long Bruno(int N, int A[]) {
	makePseudoPerm();
	long long X = 0LL;

	for(int i = 0; i < 62; ++i)
		X = X | ((long long)A[perm[i]] << i);
	int i = 62;
	while(A[perm[i]] != 1)
		++i;
	i++;
	for(int j = 0; j < 62; ++j)
		X = X | ((long long)A[perm[i + j]] << j);

	return X;
}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Incorrect 4 ms 784 KB Wrong Answer [4]
5 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Incorrect 4 ms 784 KB Wrong Answer [4]
7 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 484 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Incorrect 4 ms 912 KB Wrong Answer [4]
12 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 3 ms 516 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Incorrect 4 ms 784 KB Wrong Answer [4]
23 Incorrect 4 ms 792 KB Wrong Answer [4]
24 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Incorrect 3 ms 892 KB Wrong Answer [4]
26 Incorrect 5 ms 784 KB Wrong Answer [4]
27 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Incorrect 3 ms 920 KB Wrong Answer [4]
31 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Incorrect 4 ms 1024 KB Wrong Answer [4]
34 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Incorrect 4 ms 792 KB Wrong Answer [4]
38 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 3 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)