Submission #530883

#TimeUsernameProblemLanguageResultExecution timeMemory
530883qwerasdfzxclBroken Device (JOI17_broken_device)C++14
85 / 100
44 ms2652 KiB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

void Anna( int N, long long X, int K, int P[] ){
    bool chk[150] = {0};
    for (int i=0;i<K;i++) chk[P[i]] = 1;
    for (int i=0;i<150;i+=2){
        if (chk[i] || chk[i+1]) {Set(i, 0); Set(i+1, 0);}
        else {
            if (X%3==0) {Set(i, 0); Set(i+1, 1);}
            else if (X%3==1) {Set(i, 1); Set(i+1, 0);}
            else {Set(i, 1); Set(i+1, 1);}
            X /= 3;
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

long long Bruno( int N, int A[] ){
    ll ans = 0;
    for (int i=148;i>=0;i-=2){
        if (!A[i] && !A[i+1]) continue;
        ans *= 3;
        if (A[i]==0 && A[i+1]==1) ans += 0;
        else if (A[i]==1 && A[i+1]==0) ans += 1;
        else ans += 2;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...