# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
24869 | khsoo01 | Broken Device (JOI17_broken_device) | C++11 | 78 ms | 2836 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Annalib.h"
typedef long long ll;
int br[155], cur;
int idx[9] = {7, 5, 4, 3, 6, 2, 1, 0};
int val[9] = {1, 3, 2, 0, 0, 1, 0, 0};
int mod[9] = {4, 4, 4, 4, 2, 2, 2, 1};
void Write (int X) {
for(int i=2;i>=0;i--) {
Set(cur+i, X%2);
X /= 2;
}
cur += 3;
}
void Anna( int N, long long X, int K, int P[] ) {
for(int i=0;i<N;i++) br[i] = 0;
for(int i=0;i<K;i++) br[P[i]] = 1;
cur = 0;
for(int i=0;i<N;i+=3) {
int tmp = 4*br[i] + 2*br[i+1] + br[i+2];
for(int j=0;j<8;j++) {
if((tmp&idx[j])==idx[j] && X%mod[j]==val[j]) {
Write(idx[j]);
X /= mod[j];
break;
}
}
}
}
#include "Brunolib.h"
int idx[9] = {7, 5, 4, 3, 6, 2, 1, 0};
int val[9] = {1, 3, 2, 0, 0, 1, 0, 0};
int mod[9] = {4, 4, 4, 4, 2, 2, 2, 1};
long long Bruno( int N, int A[] ){
long long ans = 0;
for(int i=N-3;i>=0;i-=3) {
int cur = 4*A[i]+2*A[i+1]+A[i+2];
for(int j=0;j<8;j++) {
if(cur == idx[j]) {
ans *= mod[j];
ans += val[j];
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |