Submission #231264

# Submission time Handle Problem Language Result Execution time Memory
231264 2020-05-13T09:12:02 Z bensonlzl Broken Device (JOI17_broken_device) C++14
0 / 100
63 ms 3072 KB
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

typedef long long ll;

int usable[155], ans[155];

void Anna(int N, long long X, int K, int P[]){
	mt19937 rng(8537294);
	vector<int> v;
	for (int i = 0; i < N; ++i){
		usable[i] = 1;
		ans[i] = 0;
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	for (int i = 0; i < K; ++i){
		usable[P[i]] = 0;
	}
	for (int i = 0; i < N; i += 2){
		if (usable[v[i]] && usable[v[i+1]]){
			if (X%3 == 0){
				ans[v[i]] = 0;
				ans[v[i+1]] = 1;
			}
			else if (X%3 == 1){
				ans[v[i]] = 1;
				ans[v[i+1]] = 0;
			}
			else{
				ans[v[i]] = 1;
				ans[v[i+1]] = 1;
			} 
			X /= 3;
		}
		else{
			ans[v[i]] = ans[v[i+1]] = 0;
		}
	}
	if (X != 0) assert(0);
	for (int i = 0; i < N; ++i){
		Set(i,ans[i]);
	}
}
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

typedef long long ll;

long long Bruno(int N, int A[]){
	mt19937 rng(8537294); 
	ll ans = 0;
	vector<int> v;
	for (int i = 0; i < N; ++i){
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	ll coeff = 1;
	for (int i = 0; i < N; i += 2){
		if (A[v[i]] || A[v[i+1]]){
			if (A[v[i]] && !A[v[i+1]]){
				ans += 1*coeff;
			}
			else if (A[v[i]] && A[v[i+1]]){
				ans += 2*coeff;
			}
			coeff *= 3;
			if (coeff > 1e18) break;
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 63 ms 3072 KB Output is correct - L* = 40
2 Runtime error 11 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 8 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 12 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 9 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 11 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 10 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 18 ms 1664 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 12 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 14 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 9 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 11 ms 896 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 7 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 19 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 12 ms 1152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 8 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 11 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 8 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 12 ms 1024 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 7 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 7 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 9 ms 768 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 6 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 16 ms 1280 KB Execution killed with signal 11 (could be triggered by violating memory limits)