# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
531740 | pokmui9909 | Broken Device (JOI17_broken_device) | C++17 | 34 ms | 2476 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"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll C[155];
void MySet(ll n, ll a, ll b, ll c){
Set(n, a);
Set(n + 1, b);
Set(n + 2, c);
}
void Anna(int N, long long X, int K, int P[]){
fill(C, C + 155, 0);
for(ll i = 0; i < K; i++){
C[P[i]] = 1;
}
vector<ll> V;
while(V.size() <= 154){
V.push_back(X % 2);
X /= 2;
}
for(ll i = 0, j = 0; i < 150; i += 3){
if(C[i] + C[i + 1] + C[i + 2] == 0){
if(V[j] == 0 && V[j + 1] == 0) MySet(i, 1, 0, 0);
if(V[j] == 0 && V[j + 1] == 1) MySet(i, 1, 0, 1);
if(V[j] == 1 && V[j + 1] == 0) MySet(i, 0, 1, 1);
if(V[j] == 1 && V[j + 1] == 1) MySet(i, 1, 1, 1);
j += 2;
} else if(C[i] + C[i + 1] + C[i + 2] == 1) {
if(V[j] == 0){
if(C[j + 1] == 0){
MySet(i, 0, 1, 0);
j++;
} else if(V[j + 1] == 0){
MySet(i, 1, 0, 0);
j += 2;
} else {
MySet(i, 1, 0, 1);
j += 2;
}
} else if(C[i + 2] == 1) {
MySet(i, 1, 1, 0);
j++;
} else {
MySet(i, 0, 0, 1);
j++;
}
} else {
MySet(i, 0, 0, 0);
}
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll B[8] = {0, 1, 0, 1, 0, 2, 1, 3};
ll C[8] = {0, 1, 1, 2, 2, 2, 1, 2};
long long Bruno( int N, int A[] ){
ll ans = 0, s = 0;
for(int i = 0; i < N; i += 3){
ll v = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
ans |= (B[v] << s);
s += C[v];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |