Submission #330858

# Submission time Handle Problem Language Result Execution time Memory
330858 2020-11-26T18:52:09 Z NachoLibre Broken Device (JOI17_broken_device) C++14
0 / 100
1 ms 492 KB
#include <bits/stdc++.h>
using namespace std;
#define ANNACPP ANNACPP
// #define BRUNOCPP BRUNOCPP

#ifdef ANNACPP
#include "Annalib.h"

void Anna(int n, long long x, int k, int* p) {
	vector<int> v, g;
	g.resize(n, 0);
	for(int i = 0; i < k; ++i) {
		g[p[i]] = 1;
	}
	int bt = 0;
	for(int i = 0; i < n; i += 3) {
		int jg = g[i] + g[i + 1] + g[i + 2];
		if(jg == 0) {
			int tx = ((x & (1 << bt)) | (x & (1 << (bt + 1)))) >> bt;
			bt += 2;
			if(tx == 0) {
				v.push_back(0);
				v.push_back(1);
				v.push_back(1);
			} else if(tx == 1) {
				v.push_back(1);
				v.push_back(0);
				v.push_back(1);
			} else if(tx == 2) {
				v.push_back(1);
				v.push_back(1);
				v.push_back(0);
			} else if(tx == 3) {
				v.push_back(1);
				v.push_back(1);
				v.push_back(1);
			} else {
				exit(1);
			}
		} else if(jg == 1) {
			int tx = (x & (1 << bt)) >> bt;
			++bt;
			if(tx == 0) {
				if(g[i + 1]) {
					tx = (x & (1 << bt)) >> bt;
					++bt;
					if(tx == 0) {
						v.push_back(0);
						v.push_back(1);
						v.push_back(1);
					} else if(tx == 1) {
						v.push_back(1);
						v.push_back(0);
						v.push_back(1);
					} else {
						exit(1);
					}
				} else {
					v.push_back(0);
					v.push_back(1);
					v.push_back(0);
				}
			} else if(tx == 1) {
				if(g[i]) {
					v.push_back(0);
					v.push_back(0);
					v.push_back(1);
				} else {
					v.push_back(1);
					v.push_back(0);
					v.push_back(0);
				}
			} else {
				exit(1);
			}
		} else {
			v.push_back(0);
			v.push_back(0);
			v.push_back(0);
		}
	}
	for(int i = 0; i < n; ++i) {
		Set(i, v[i]);
	}
}

#endif

#ifdef BRUNOCPP
#include "Brunolib.h"

long long Bruno(int n, int* a) {
	long long x = 0;
	int bt = 0;
	for(int i = 0; i < n; i += 3) {
		int m = a[i] * 4 + a[i + 1] * 2 + a[i + 2];
		if(m == 0);
		else if(m == 1) x |= (1ll << bt), ++bt;
		else if(m == 2) ++bt;
		else if(m == 3) bt += 2;
		else if(m == 4) x |= (1ll << bt), ++bt;
		else if(m == 5) ++bt, x |= (1ll << bt), ++bt;
		else if(m == 6) x |= (1ll << bt), bt += 2;
		else if(m == 7) x |= (1ll << bt), ++bt, x |= (1ll << bt), ++bt;
	}
	return x;
}

#endif


#ifdef WEEE
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	return 0;
}
#endif
#include <bits/stdc++.h>
using namespace std;
// #define ANNACPP ANNACPP
#define BRUNOCPP BRUNOCPP

#ifdef ANNACPP
#include "Annalib.h"

void Anna(int n, long long x, int k, int* p) {
	vector<int> v, g;
	g.resize(n, 0);
	for(int i = 0; i < k; ++i) {
		g[p[i]] = 1;
	}
	int bt = 0;
	for(int i = 0; i < n; i += 3) {
		int jg = g[i] + g[i + 1] + g[i + 2];
		if(jg == 0) {
			int tx = ((x & (1 << bt)) | (x & (1 << (bt + 1)))) >> bt;
			bt += 2;
			if(tx == 0) {
				v.push_back(0);
				v.push_back(1);
				v.push_back(1);
			} else if(tx == 1) {
				v.push_back(1);
				v.push_back(0);
				v.push_back(1);
			} else if(tx == 2) {
				v.push_back(1);
				v.push_back(1);
				v.push_back(0);
			} else if(tx == 3) {
				v.push_back(1);
				v.push_back(1);
				v.push_back(1);
			} else {
				exit(1);
			}
		} else if(jg == 1) {
			int tx = (x & (1 << bt)) >> bt;
			++bt;
			if(tx == 0) {
				if(g[i + 1]) {
					tx = (x & (1 << bt)) >> bt;
					++bt;
					if(tx == 0) {
						v.push_back(0);
						v.push_back(1);
						v.push_back(1);
					} else if(tx == 1) {
						v.push_back(1);
						v.push_back(0);
						v.push_back(1);
					} else {
						exit(1);
					}
				} else {
					v.push_back(0);
					v.push_back(1);
					v.push_back(0);
				}
			} else if(tx == 1) {
				if(g[i]) {
					v.push_back(0);
					v.push_back(0);
					v.push_back(1);
				} else {
					v.push_back(1);
					v.push_back(0);
					v.push_back(0);
				}
			} else {
				exit(1);
			}
		} else {
			v.push_back(0);
			v.push_back(0);
			v.push_back(0);
		}
	}
	for(int i = 0; i < n; ++i) {
		Set(i, v[i]);
	}
}

#endif

#ifdef BRUNOCPP
#include "Brunolib.h"

long long Bruno(int n, int* a) {
	long long x = 0;
	int bt = 0;
	for(int i = 0; i < n; i += 3) {
		int m = a[i] * 4 + a[i + 1] * 2 + a[i + 2];
		if(m == 0);
		else if(m == 1) x |= (1ll << bt), ++bt;
		else if(m == 2) ++bt;
		else if(m == 3) bt += 2;
		else if(m == 4) x |= (1ll << bt), ++bt;
		else if(m == 5) ++bt, x |= (1ll << bt), ++bt;
		else if(m == 6) x |= (1ll << bt), bt += 2;
		else if(m == 7) x |= (1ll << bt), ++bt, x |= (1ll << bt), ++bt;
	}
	return x;
}

#endif


#ifdef WEEE
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	return 0;
}
#endif
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
2 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
3 Runtime error 1 ms 492 KB Execution failed because the return code was nonzero
4 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
5 Runtime error 1 ms 384 KB Execution failed because the return code was nonzero
6 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 364 KB Execution failed because the return code was nonzero
8 Runtime error 1 ms 384 KB Execution failed because the return code was nonzero
9 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 384 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
16 Runtime error 1 ms 416 KB Execution failed because the return code was nonzero
17 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
18 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
19 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
20 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
21 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
22 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
23 Runtime error 0 ms 364 KB Execution failed because the return code was nonzero
24 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
25 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
26 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
27 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
28 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
29 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
30 Runtime error 1 ms 384 KB Execution failed because the return code was nonzero
31 Runtime error 1 ms 376 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
33 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
34 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
35 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
36 Runtime error 1 ms 384 KB Execution failed because the return code was nonzero
37 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
38 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
39 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero
40 Runtime error 1 ms 364 KB Execution failed because the return code was nonzero