# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26508 | youaremysky99 | Broken Device (JOI17_broken_device) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}