# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1154546 | yhkhoo | Broken Device (JOI17_broken_device) | C++20 | 22 ms | 1544 KiB |
#include "Annalib.h"
typedef long long ll;
void Anna( int N, ll X, int K, int P[] ){
int xd[38];
bool p[N];
for(int i=0; i<N; i++){
p[i] = 0;
}
for(int i=0; i<K; i++){
p[P[i]] = 1;
}
ll x = X;
for(int i=0; i<38; i++){
xd[i] = x % 3;
x /= 3;
}
auto xp = xd;
for(int i=0; i<N; i+=2){
if(xp-xd == 38 || p[i] || p[i+1]){
Set(i, 0);
Set(i+1, 0);
continue;
}
if((*xp) == 0){
Set(i, 0);
Set(i+1, 1);
}
else if((*xp) == 1){
Set(i, 1);
Set(i+1, 0);
}
else{
Set(i, 1);
Set(i+1, 1);
}
xp++;
}
}
#include "Brunolib.h"
typedef long long ll;
ll Bruno( int N, int A[] ){
ll m = 1, ans = 0;
for(int i=0; i<N; i+=2){
if(A[i] && A[i+1]){
ans += m*2;
}
else if(A[i]){
ans += m;
}
else if(!A[i+1]){
continue;
}
m *= 3;
//fprintf( stderr, "Burnox %IId\n", ans );
}
//fprintf( stderr, "Burno %IId\n", ans );
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |