Submission #448144

#TimeUsernameProblemLanguageResultExecution timeMemory
448144JovanBBroken Device (JOI17_broken_device)C++17
0 / 100
46 ms2536 KiB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

static const ll K = 626237348924392349LL;

static int radi[1005];

static int ord[] = {24, 2, 18, 98, 0, 54, 116, 144, 58, 90, 36, 124, 64, 80, 142, 102, 52, 82, 96, 34, 16, 94, 128, 132, 130, 14, 12, 22, 10, 8, 4, 104, 108, 70, 112, 78, 50, 6, 86, 32, 122, 136, 28, 26, 48, 110, 126, 38, 40, 118, 20, 66, 42, 56, 148, 30, 100, 68, 72, 88, 106, 76, 92, 120, 134, 60, 114, 44, 74, 46, 140, 138, 62, 84, 146};

void Anna(int _n, long long X, int _k, int P[] ){
    int n = _n;
    int k = _k;
    for(int i=0; i<n; i++) radi[i] = 1;
    for(int i=0; i<k; i++) radi[P[i]] = 0;
    if(k > 38){
        for(int i=0; i<n; i++) Set(i, 1);
        return;
    }
    X ^= K;
    int j = 0;
    for(int i=0; i<38; i++){
        int treba = X%3;
        X /= 3;
        treba++;
        for(;;){
            if(treba/2 <= radi[ord[j]] && treba%2 <= radi[ord[j]+1]){
                Set(ord[j], treba/2);
                Set(ord[j]+1, treba%2);
                j++;
                break;
            }
            Set(ord[j], 0);
            Set(ord[j]+1, 0);
            j++;
        }
    }
    while(j < n/2){
        Set(ord[j], 0);
        Set(ord[j]+1, 0);
        j++;
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

static const ll K = 626237348924392349LL;

static int ord[] = {24, 2, 18, 98, 0, 54, 116, 144, 58, 90, 36, 124, 64, 80, 142, 102, 52, 82, 96, 34, 16, 94, 128, 132, 130, 14, 12, 22, 10, 8, 4, 104, 108, 70, 112, 78, 50, 6, 86, 32, 122, 136, 28, 26, 48, 110, 126, 38, 40, 118, 20, 66, 42, 56, 148, 30, 100, 68, 72, 88, 106, 76, 92, 120, 134, 60, 114, 44, 74, 46, 140, 138, 62, 84, 146};

long long Bruno( int N, int A[] ){
    int j = 0;
    ll p3 = 1;
    ll res = 0;
    for(int i=0; i<38; i++){
        int tr;
        for(;;){
            tr = 2*A[ord[j]] + A[ord[j]+1];
            j++;
            if(tr) break;
        }
        res += (tr-1)*p3;
        p3 *= 3;
    }
    return res ^ K;
}
#Verdict Execution timeMemoryGrader output
Fetching results...