답안 #26508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
26508 2017-07-01T16:07:14 Z youaremysky99 Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include "Annalib.h"
#include <iostream> 
#include <cstdio>

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) {
			while (broken[cur]) {
				Set(cur,0);
				++cur;
			}
			if (onbit(X, pos) && broken[cur + 1]) {
				Set(cur,0); 
				++cur;
				continue;
			}
			if (onbit(X, pos + 1) && broken[cur + 2]) {
				Set(cur,0);
				++cur;
				continue;
			}

			found = true;
			Set(cur,1); ++cur;
			Set(cur,onbit(X, pos)); ++cur;
			Set(cur,onbit(X, pos + 1)); ++cur;
		}
	}
	while (cur < 150) {
		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++) 

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

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 + 1));
		if (A[cur + 2]) res |= (1LL << (pos + 2));
		cur = cur + 3;
	} 

	return res;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:17:32: error: 'memset' was not declared in this scope
  memset(broken,0,sizeof(broken));
                                ^