# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
26859 | wangyenjen | Broken Device (JOI17_broken_device) | C++14 | 65 ms | 4640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/// Author: Wang, Yen-Jen
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
static bool A[150];
static bool B[150];
static int cnt[50];
static bool st[150];
inline static void my_set(int p , int a , int b , int c) {
B[p * 3] = a;
B[p * 3 + 1] = b;
B[p * 3 + 2] = c;
}
void Anna(int N , long long X , int K , int P[]) {
memset(st , 0 , sizeof(st));
memset(cnt , 0 , sizeof(cnt));
for(int i = 0; i < K; i++) {
st[P[i]] = 1;
cnt[P[i] / 3]++;
}
memset(A , 0 , sizeof(A));
for(int i = 0; i < 60; i++) {
A[i] = (X&1);
X >>= 1;
}
int cc = 0;
memset(B , 0 , sizeof(B));
for(int i = 0; i < N / 3; i++) {
if(cnt[i] >= 2) continue;
if(cnt[i] == 0) {
if(A[cc]) {
if(A[cc + 1]) my_set(i , 1 , 1 , 1);
else my_set(i , 0 , 1 , 1);
}
else {
if(A[cc + 1]) my_set(i , 1 , 0 , 1);
else my_set(i , 1 , 0 , 0);
}
cc += 2;
}
else {
if(st[i * 3]) {
if(A[cc]) my_set(i , 0 , 0 , 1);
else my_set(i , 0 , 1 , 0);
cc++;
}
else if(st[i * 3 + 1]) {
if(A[cc]) {
my_set(i , 0 , 0 , 1);
cc++;
}
else if(!A[cc] && !A[cc + 1]) {
my_set(i , 1 , 0 , 1);
cc += 2;
}
else {
my_set(i , 1 , 0 , 0);
cc += 2;
}
}
else {
if(A[cc]) {
my_set(i , 1 , 1 , 0);
cc++;
}
else {
my_set(i , 0 , 1 , 0);
cc++;
}
}
}
}
for(int i = 0; i < N; i++) Set(i , B[i]);
}
/// Author: Wang, Yen-Jen
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
static int B[150];
long long Bruno(int N , int A[]) {
long long X = 0;
int cc = 0;
for(int i = 0; i < N / 3; i++) {
if(!(A[i * 3] || A[i * 3 + 1] || A[i * 3 + 2])) continue;
if(A[i * 3]) {
if(A[i * 3 + 1]) {
if(A[i * 3 + 2]) B[cc++] = 1 , B[cc++] = 1;
else B[cc++] = 1;
}
else {
if(A[i * 3 + 2]) B[cc++] = 0 , B[cc++] = 1;
else B[cc++] = 0 , B[cc++] = 0;
}
}
else {
if(A[i * 3 + 1]) {
if(A[i * 3 + 2]) B[cc++] = 1 , B[cc++] = 0;
else B[cc++] = 0;
}
else if(A[i * 3 + 2]) B[cc++] = 1;
}
}
for(int i = 0; i < 60; i++) X |= ((long long)B[i]<<i);
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |