Submission #1154538

#TimeUsernameProblemLanguageResultExecution timeMemory
1154538yhkhooBroken Device (JOI17_broken_device)C++20
0 / 100
19 ms1344 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(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;
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...