Submission #43814

# Submission time Handle Problem Language Result Execution time Memory
43814 2018-03-24T07:41:43 Z cheater2k Broken Device (JOI17_broken_device) C++14
0 / 100
79 ms 13696 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;

vector <int> mp2[4];
vector <int> mp1[3];
bool broken[155];

int getbit(long long X, int i) {
	if (i <= 62) return (X >> i & 1);
	else return 0;
}

void Anna(int N, long long X, int K, int P[]) {
	mp1[0] = {0, 0, 1}; // 0
	mp1[1] = {0, 1, 1}; // 1
	mp1[2] = {1, 0, 0}; // 1
	mp2[0] = {0, 1, 0}; // 00
	mp2[1] = {1, 0, 1}; // 01
	mp2[2] = {1, 1, 0}; // 10
	mp2[3] = {1, 1, 1}; // 11

  for (int i = 0; i < K; ++i) broken[P[i]] = 1;

  int cur = 0;
  for (int i = 0; i < N; i += 3) {
  	int cnt = broken[i] + broken[i + 1] + broken[i + 2];
  	if (cnt >= 2) {
  		Set(i, 0);
  		Set(i + 1, 0);
  		Set(i + 2, 0);
  	}
  	else if (cnt == 0) {
  		int x = getbit(X, cur) + getbit(X, cur + 1) * 2;
  		Set(i, mp2[x][0]);
  		Set(i + 1, mp2[x][1]);
  		Set(i + 2, mp2[x][2]);
  		cur += 2;
  	}
  	else { // cnt = 1
  		if (getbit(X, cur)) {
  			int x = 2; if (broken[i]) x = 1; 
  			Set(i, mp1[x][0]), Set(i + 1, mp1[x][1]), Set(i + 2, mp1[x][2]);
  			++cur;
  		} else {
  			if (!broken[i + 2]) {
  				Set(i, mp1[0][0]), Set(i + 1, mp1[0][1]), Set(i + 2, mp1[0][2]);
  				++cur;
  			} else { // 00 or 10
  				int x = getbit(X, cur + 1) * 2;
  				Set(i, mp2[x][0]), Set(i + 1, mp2[x][1]), Set(i + 2, mp2[x][2]);
  				cur += 2;
  			}
  		}
  	}
  }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;

int val[8], bits[8];

long long Bruno(int N, int A[]) {
	val[1] = 0, bits[1] = 1;
	val[2] = 0, bits[2] = 2;
	val[3] = 1, bits[3] = 1;
	val[4] = 1, bits[4] = 1;
	val[5] = 1, bits[5] = 2;
	val[6] = 2, bits[6] = 2;
	val[7] = 3, bits[7] = 2;

	long long ret = 0;
	int cur = 0;
  for (int i = 0; i < N; i += 3) {
  	int x = 4 * A[i] + 2 * A[i + 1] + A[i + 2];
  	if (!x) continue;

  	if (cur > 61) break;
  	ret += 1LL * val[x] * (1LL << cur);
  	cur += bits[x];
  }
  return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 3312 KB Output isn't correct - L* = 0
2 Incorrect 39 ms 3912 KB Output isn't correct - L* = 0
3 Incorrect 39 ms 4248 KB Output isn't correct - L* = 0
4 Incorrect 51 ms 4960 KB Output isn't correct - L* = 0
5 Incorrect 39 ms 4992 KB Output isn't correct - L* = 0
6 Incorrect 38 ms 5256 KB Output isn't correct - L* = 0
7 Incorrect 38 ms 5504 KB Output isn't correct - L* = 0
8 Incorrect 38 ms 6008 KB Output isn't correct - L* = 0
9 Incorrect 38 ms 6104 KB Output isn't correct - L* = 0
10 Incorrect 38 ms 6344 KB Output isn't correct - L* = 0
11 Incorrect 39 ms 6592 KB Output isn't correct - L* = 0
12 Incorrect 41 ms 6840 KB Output isn't correct - L* = 0
13 Incorrect 58 ms 7184 KB Output isn't correct - L* = 0
14 Incorrect 39 ms 7344 KB Output isn't correct - L* = 0
15 Incorrect 43 ms 7584 KB Output isn't correct - L* = 0
16 Incorrect 65 ms 7984 KB Output isn't correct - L* = 0
17 Incorrect 40 ms 8072 KB Output isn't correct - L* = 0
18 Incorrect 61 ms 8312 KB Output isn't correct - L* = 0
19 Incorrect 79 ms 8552 KB Output isn't correct - L* = 0
20 Incorrect 60 ms 8800 KB Output isn't correct - L* = 0
21 Incorrect 61 ms 9304 KB Output isn't correct - L* = 0
22 Incorrect 59 ms 9304 KB Output isn't correct - L* = 0
23 Incorrect 61 ms 9528 KB Output isn't correct - L* = 0
24 Incorrect 61 ms 10032 KB Output isn't correct - L* = 0
25 Incorrect 50 ms 10032 KB Output isn't correct - L* = 0
26 Incorrect 39 ms 10768 KB Output isn't correct - L* = 0
27 Incorrect 45 ms 10768 KB Output isn't correct - L* = 0
28 Incorrect 45 ms 11016 KB Output isn't correct - L* = 0
29 Incorrect 45 ms 11016 KB Output isn't correct - L* = 0
30 Incorrect 38 ms 11576 KB Output isn't correct - L* = 0
31 Incorrect 56 ms 11576 KB Output isn't correct - L* = 0
32 Incorrect 46 ms 11728 KB Output isn't correct - L* = 0
33 Incorrect 38 ms 11976 KB Output isn't correct - L* = 0
34 Incorrect 39 ms 12216 KB Output isn't correct - L* = 0
35 Incorrect 38 ms 12456 KB Output isn't correct - L* = 0
36 Incorrect 48 ms 12704 KB Output isn't correct - L* = 0
37 Incorrect 45 ms 12952 KB Output isn't correct - L* = 0
38 Incorrect 50 ms 13200 KB Output isn't correct - L* = 0
39 Incorrect 56 ms 13504 KB Output isn't correct - L* = 0
40 Incorrect 48 ms 13696 KB Output isn't correct - L* = 0