# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72701 | ikura355 | Broken Device (JOI17_broken_device) | C++14 | 83 ms | 3984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 150 + 5;
int bad[maxn], res[maxn];
void Anna(int N, long long X, int K, int P[]) {
for(int i=0;i<N;i++) bad[i] = 0;
for(int i=0;i<K;i++) bad[P[i]] = 1;
for(int i=0;i<N;i++) res[i] = 0;
for(int i=0;i<N;i+=3) {
if(bad[i] + bad[i+1] + bad[i+2] == 0) {
int val = X%4;
if(val==0) res[i+1] = 1;
if(val==1) res[i+1] = 1, res[i+2] = 1;
if(val==2) res[i] = res[i+2] = 1;
if(val==3) res[i] = res[i+1] = res[i+2] = 1;
X /= 4;
}
else if(bad[i] + bad[i+1] + bad[i+2] == 1) {
int val = X%2;
if(val==0) {
if(bad[i] || bad[i+1]) res[i+2] = 1;
if(bad[i+2]) res[i] = res[i+1] = 1;
X /= 2;
}
if(val==1) {
if(bad[i+1] || bad[i+2]) {
res[i] = 1;
X /= 2;
}
}
}
}
for(int i=0;i<N;i++) Set(i,res[i]);
}
#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
long long Bruno(int N, int A[]) {
long long ans = 0;
for(int i=N-3;i>=0;i-=3) {
int x = A[i], y = A[i+1], z = A[i+2];
int val = x*4 + y*2 + z;
if(val==1 || val==6) ans = ans*2;
if(val==4) ans = ans*2 + 1;
if(val==2) ans = ans*4;
if(val==3) ans = ans*4 + 1;
if(val==5) ans = ans*4 + 2;
if(val==7) ans = ans*4 + 3;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |