답안 #26511

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26511 2017-07-01T16:21:26 Z youaremysky99 Broken Device (JOI17_broken_device) C++14
51 / 100
62 ms 4636 KB
#include "Annalib.h"
#include <iostream> 
#include <cstdio>
#include <cstring>

using namespace std;

#define For(i,a,b) for (int i = (a), _b = (b) ; i <= _b; i++) 

bool onbit(const long long state, const int pos) {
	return (state >> pos) & 1;
}

const int L = 60;
bool broken[500];

void Anna( int N, long long X, int K, int P[] ){
	memset(broken,0,sizeof(broken));
	for (int i = 0 ; i < K; i++) broken[P[i]] = true;

	int cur = 0;
	for (int pos = 0; pos < L; pos += 2) {
		bool found = false;
		while (!found && cur < N) {
			while (broken[cur] && cur < N) {
				if (cur < N) Set(cur,0);
				++cur;
			}
			if (onbit(X, pos) && broken[cur + 1]) {
				if (cur < N) Set(cur,0); 
				++cur;
				continue;
			}
			if (onbit(X, pos + 1) && broken[cur + 2]) {
				if (cur < N) Set(cur,0);
				++cur;
				continue;
			}

			found = true;
			if (cur < N) Set(cur,1); ++cur;
			if (cur < N) Set(cur,onbit(X, pos)); ++cur;
			if (cur < N) Set(cur,onbit(X, pos + 1)); ++cur;
		}
	}
	while (cur < N) {
		Set(cur,0);++cur;
	}
}
#include "Annalib.h"
#include <iostream> 
#include <cstdio>

using namespace std;

#define For(i,a,b) for (int i = (a), _b = (b) ; i <= _b; i++) 


long long Bruno( int N, int A[] ){
	int cur = 0;
	int pos = 0;
	long long res = 0;

	for (; pos < 60 ; pos +=2 ) {
		while (!A[cur]) ++cur;

		if (A[cur + 1]) res |= (1LL << (pos));
		if (A[cur + 2]) res |= (1LL << (pos + 1));
		cur = cur + 3;
	} 
	
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 52 ms 4636 KB Output is partially correct - L* = 22
2 Partially correct 41 ms 4636 KB Output is partially correct - L* = 20
3 Partially correct 35 ms 4636 KB Output is partially correct - L* = 21
4 Partially correct 35 ms 4636 KB Output is partially correct - L* = 23
5 Partially correct 35 ms 4636 KB Output is partially correct - L* = 20
6 Partially correct 46 ms 4636 KB Output is partially correct - L* = 22
7 Partially correct 46 ms 4636 KB Output is partially correct - L* = 20
8 Partially correct 54 ms 4636 KB Output is partially correct - L* = 21
9 Partially correct 41 ms 4636 KB Output is partially correct - L* = 20
10 Partially correct 46 ms 4636 KB Output is partially correct - L* = 23
11 Partially correct 48 ms 4636 KB Output is partially correct - L* = 20
12 Partially correct 32 ms 4636 KB Output is partially correct - L* = 21
13 Partially correct 45 ms 4636 KB Output is partially correct - L* = 23
14 Partially correct 52 ms 4636 KB Output is partially correct - L* = 22
15 Partially correct 49 ms 4636 KB Output is partially correct - L* = 23
16 Partially correct 39 ms 4636 KB Output is partially correct - L* = 21
17 Partially correct 28 ms 4636 KB Output is partially correct - L* = 21
18 Partially correct 48 ms 4636 KB Output is partially correct - L* = 20
19 Partially correct 41 ms 4636 KB Output is partially correct - L* = 20
20 Partially correct 45 ms 4636 KB Output is partially correct - L* = 22
21 Partially correct 45 ms 4636 KB Output is partially correct - L* = 21
22 Partially correct 38 ms 4636 KB Output is partially correct - L* = 22
23 Partially correct 62 ms 4636 KB Output is partially correct - L* = 21
24 Partially correct 45 ms 4636 KB Output is partially correct - L* = 22
25 Partially correct 45 ms 4636 KB Output is partially correct - L* = 20
26 Partially correct 41 ms 4636 KB Output is partially correct - L* = 21
27 Partially correct 35 ms 4636 KB Output is partially correct - L* = 23
28 Partially correct 32 ms 4636 KB Output is partially correct - L* = 21
29 Partially correct 45 ms 4636 KB Output is partially correct - L* = 23
30 Partially correct 45 ms 4636 KB Output is partially correct - L* = 22
31 Partially correct 45 ms 4636 KB Output is partially correct - L* = 22
32 Partially correct 41 ms 4636 KB Output is partially correct - L* = 23
33 Partially correct 39 ms 4636 KB Output is partially correct - L* = 20
34 Partially correct 41 ms 4636 KB Output is partially correct - L* = 22
35 Partially correct 45 ms 4636 KB Output is partially correct - L* = 23
36 Partially correct 32 ms 4636 KB Output is partially correct - L* = 21
37 Partially correct 41 ms 4636 KB Output is partially correct - L* = 22
38 Partially correct 41 ms 4636 KB Output is partially correct - L* = 22
39 Partially correct 41 ms 4636 KB Output is partially correct - L* = 20
40 Partially correct 49 ms 4636 KB Output is partially correct - L* = 20