Submission #61191

# Submission time Handle Problem Language Result Execution time Memory
61191 2018-07-25T10:34:01 Z ainta Broken Device (JOI17_broken_device) C++17
0 / 100
83 ms 3856 KB
#include "Annalib.h"

int v[200], res[220];

void Anna( int N, long long X, int K, int P[] ){
	int i, j, k;
	for (i = 0; i < N; i++)res[i] = v[i] = 0;
	for (i = 0; i < K; i++) {
		v[P[i]] = 1;
	}
	for (i = 0; i < N; i+=3) {
		if (v[i] + v[i + 1] + v[i+2] >= 2)continue;
		if (v[i] + v[i + 1] + v[i + 2] == 1) {
			if (X % 2 == 0) {
				if (v[i]) {
					res[i + 2] = 1;
				}
				if (v[i + 1]) {
					res[i + 2] = 1;
				}
				if (v[i + 2]) {
					res[i] = res[i + 1] = 1;
				}
			}
			else {
				if (v[i]) {
					if (X % 4 == 1) {
						res[i + 1] = 1;
					}
					else {
						res[i + 1] = res[i + 2] = 1;
					}

				}
				if (v[i + 1]) {
					res[i] = 1;
				}
				if (v[i + 2]) {
					res[i] = 1;
				}
			}
		}
		else {
			res[i] = res[i + 1] = res[i + 2] = 1;
			if (X % 4 == 1) res[i] = res[i + 2] = 0;
			if (X % 4 == 2) res[i + 1] = 0;
			if (X % 4 == 3) res[i] = 0;
		}
	}
	for (i = 0; i < N; i++)Set(i, res[i]);
}
#include "Brunolib.h"
#include <algorithm>
using namespace std;
#define pii pair<int,int>

pii Get(int x, int y, int z) {
	int t = x * 4 + y * 2 + z;
	if (t == 7)return pii(0,4);
	if (t == 6)return pii(0,2);
	if (t == 5)return pii(2,4);
	if (t == 4)return pii(1,2);
	if (t == 3)return pii(3,4);
	if (t == 2)return pii(1,4);
	if (t == 1)return pii(0,2);
	if (t == 0)return pii(0,1);
}

long long Bruno( int N, int A[] ){
	int i;
	long long res = 0;
	for (i = N-3; i >=0; i-=3) {
		pii tp = Get(A[i], A[i + 1], A[i + 2]);
		res = res*tp.second + tp.first;
	}
	return res;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:6:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, k;
         ^
Anna.cpp:6:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k;
            ^

Bruno.cpp: In function 'std::pair<int, int> Get(int, int, int)':
Bruno.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 2800 KB Output isn't correct - L* = 0
2 Incorrect 57 ms 3552 KB Output isn't correct - L* = 0
3 Incorrect 46 ms 3552 KB Output isn't correct - L* = 0
4 Incorrect 47 ms 3552 KB Output isn't correct - L* = 0
5 Incorrect 55 ms 3552 KB Output isn't correct - L* = 0
6 Incorrect 59 ms 3736 KB Output isn't correct - L* = 0
7 Incorrect 48 ms 3736 KB Output isn't correct - L* = 0
8 Incorrect 49 ms 3752 KB Output isn't correct - L* = 0
9 Incorrect 73 ms 3752 KB Output isn't correct - L* = 0
10 Incorrect 51 ms 3752 KB Output isn't correct - L* = 0
11 Incorrect 77 ms 3752 KB Output isn't correct - L* = 0
12 Incorrect 63 ms 3768 KB Output isn't correct - L* = 0
13 Incorrect 63 ms 3768 KB Output isn't correct - L* = 0
14 Incorrect 49 ms 3768 KB Output isn't correct - L* = 0
15 Incorrect 53 ms 3768 KB Output isn't correct - L* = 0
16 Incorrect 63 ms 3856 KB Output isn't correct - L* = 0
17 Incorrect 48 ms 3856 KB Output isn't correct - L* = 0
18 Incorrect 68 ms 3856 KB Output isn't correct - L* = 0
19 Incorrect 63 ms 3856 KB Output isn't correct - L* = 0
20 Incorrect 55 ms 3856 KB Output isn't correct - L* = 0
21 Incorrect 65 ms 3856 KB Output isn't correct - L* = 0
22 Incorrect 73 ms 3856 KB Output isn't correct - L* = 0
23 Incorrect 54 ms 3856 KB Output isn't correct - L* = 0
24 Incorrect 56 ms 3856 KB Output isn't correct - L* = 0
25 Incorrect 60 ms 3856 KB Output isn't correct - L* = 0
26 Incorrect 66 ms 3856 KB Output isn't correct - L* = 0
27 Incorrect 65 ms 3856 KB Output isn't correct - L* = 0
28 Incorrect 72 ms 3856 KB Output isn't correct - L* = 0
29 Incorrect 56 ms 3856 KB Output isn't correct - L* = 0
30 Incorrect 55 ms 3856 KB Output isn't correct - L* = 0
31 Incorrect 56 ms 3856 KB Output isn't correct - L* = 0
32 Incorrect 81 ms 3856 KB Output isn't correct - L* = 0
33 Incorrect 66 ms 3856 KB Output isn't correct - L* = 0
34 Incorrect 65 ms 3856 KB Output isn't correct - L* = 0
35 Incorrect 63 ms 3856 KB Output isn't correct - L* = 0
36 Incorrect 57 ms 3856 KB Output isn't correct - L* = 0
37 Incorrect 83 ms 3856 KB Output isn't correct - L* = 0
38 Incorrect 59 ms 3856 KB Output isn't correct - L* = 0
39 Incorrect 69 ms 3856 KB Output isn't correct - L* = 0
40 Incorrect 61 ms 3856 KB Output isn't correct - L* = 0