Submission #61195

# Submission time Handle Problem Language Result Execution time Memory
61195 2018-07-25T10:44:32 Z youngyojun Broken Device (JOI17_broken_device) C++11
100 / 100
88 ms 3968 KB
#include "Annalib.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define revv(V) reverse(allv(V))
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

static int A[160], B[66];

void Anna(int N, ll X, int K, int P[]) {
	fill(A, A+N+1, 1);
	for(int i = 0; i < K; i++) A[P[i]] = 0;
	for(int i = 0; i < 60; i++) B[i] = !!(X & (1ll<<i));

	for(int i = 0, j = 0; i < N && j < 60; i += 3) {
		if(A[i] + A[i+1] + A[i+2] < 2) {
			A[i] = A[i+1] = A[i+2] = 0;
			continue;
		}
		if(B[j] && B[j+1]) { // 11
			if(A[i] && A[i+1] && A[i+2]) {
				j += 2;
				continue;
			}
			if(A[i+1]) A[i] = A[i+2] = 0;
			j++;
		} else if(B[j]) { // 10
			if(A[i+1] && A[i+2]) {
				A[i] = 0;
				j += 2;
				continue;
			}
			if(A[i+1]) A[i] = A[i+2] = 0;
			j++;
		} else if(!B[j] && B[j+1]) { // 01
			if(A[i]) {
				A[i+1] = A[i+2] = 0;
				j += 2;
				continue;
			}
			A[i] = A[i+1] = 0;
			j++;
		} else { // 00
			if(A[i] && A[i+1]) {
				A[i+2] = 0;
				j += 2;
				continue;
			}
			A[i] = A[i+1] = 0;
			j++;
		}
	}

	for(int i = 0; i < N; i++) Set(i, !!A[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define revv(V) reverse(allv(V))
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

ll Bruno(int N, int A[]) {
	vector<int> V;

	for(int i = 0; i < N; i += 3) if(A[i] || A[i+1] || A[i+2]) {
		int t = (A[i]<<2) | (A[i+1]<<1) | A[i+2];
		if(1 == t) V.eb(0);
		else if(2 == t) V.eb(1);
		else if(3 == t) { V.eb(1); V.eb(0); }
		else if(4 == t) { V.eb(0); V.eb(1); }
		else if(5 == t) V.eb(1);
		else if(6 == t) { V.eb(0); V.eb(0); }
		else { V.eb(1); V.eb(1); }
	}

	ll ret = 0;
	for(int j = 60; j--;)
		ret = (ret << 1) | V[j];
	return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 52 ms 2800 KB Output is correct - L* = 40
2 Correct 49 ms 3192 KB Output is correct - L* = 40
3 Correct 66 ms 3384 KB Output is correct - L* = 40
4 Correct 66 ms 3560 KB Output is correct - L* = 40
5 Correct 50 ms 3560 KB Output is correct - L* = 40
6 Correct 53 ms 3744 KB Output is correct - L* = 40
7 Correct 70 ms 3744 KB Output is correct - L* = 40
8 Correct 66 ms 3744 KB Output is correct - L* = 40
9 Correct 52 ms 3744 KB Output is correct - L* = 40
10 Correct 56 ms 3744 KB Output is correct - L* = 40
11 Correct 63 ms 3744 KB Output is correct - L* = 40
12 Correct 55 ms 3744 KB Output is correct - L* = 40
13 Correct 66 ms 3744 KB Output is correct - L* = 40
14 Correct 73 ms 3744 KB Output is correct - L* = 40
15 Correct 73 ms 3744 KB Output is correct - L* = 40
16 Correct 56 ms 3744 KB Output is correct - L* = 40
17 Correct 50 ms 3744 KB Output is correct - L* = 40
18 Correct 50 ms 3744 KB Output is correct - L* = 40
19 Correct 51 ms 3744 KB Output is correct - L* = 40
20 Correct 50 ms 3744 KB Output is correct - L* = 40
21 Correct 52 ms 3744 KB Output is correct - L* = 40
22 Correct 50 ms 3744 KB Output is correct - L* = 40
23 Correct 59 ms 3744 KB Output is correct - L* = 40
24 Correct 64 ms 3744 KB Output is correct - L* = 40
25 Correct 48 ms 3968 KB Output is correct - L* = 40
26 Correct 56 ms 3968 KB Output is correct - L* = 40
27 Correct 57 ms 3968 KB Output is correct - L* = 40
28 Correct 54 ms 3968 KB Output is correct - L* = 40
29 Correct 59 ms 3968 KB Output is correct - L* = 40
30 Correct 52 ms 3968 KB Output is correct - L* = 40
31 Correct 58 ms 3968 KB Output is correct - L* = 40
32 Correct 49 ms 3968 KB Output is correct - L* = 40
33 Correct 48 ms 3968 KB Output is correct - L* = 40
34 Correct 69 ms 3968 KB Output is correct - L* = 40
35 Correct 50 ms 3968 KB Output is correct - L* = 40
36 Correct 49 ms 3968 KB Output is correct - L* = 40
37 Correct 50 ms 3968 KB Output is correct - L* = 40
38 Correct 88 ms 3968 KB Output is correct - L* = 40
39 Correct 61 ms 3968 KB Output is correct - L* = 40
40 Correct 51 ms 3968 KB Output is correct - L* = 40