Submission #1077200

#TimeUsernameProblemLanguageResultExecution timeMemory
1077200AMO5Broken Device (JOI17_broken_device)C++17
67 / 100
31 ms3028 KiB
#include "Annalib.h"
#include "bits/stdc++.h"
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    std::vector<int>bad(N, 0);
    for(int i=0; i<K; i++)bad[P[i]]=1;

    long long tmp = X;
    for(int i=0; i<N; i+=3){
        if(bad[i] || (i + 1 < N && bad[i+1]) || (i + 2 < N && bad[i+2])  || tmp == 0){
            Set(i, 0);
            Set(i+1, 0);
            Set(i+2, 0);
        }else{
            int bit = tmp % 7 + 1;
            Set(i, bit / 4);
            Set(i+1, bit % 4 / 2);
            Set(i+2, bit % 2);
            tmp /= 7;
        }
    }
}
#include "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;

long long Bruno( int N, int A[] ){
    std::vector<int>bits;
    for(int i=0; i<N; i+=3){
        if(A[i] == 0 && A[i+1] == 0 && A[i+2] == 0)continue;
        int val = 4 * A[i] + 2 * A[i+1] + A[i+2] - 1;
        bits.emplace_back(val);
    }
    long long answer = 0LL;
    while(!bits.empty()){
        answer *= 7LL;
        answer += bits.back();
        bits.pop_back();
    }
    return answer;
}
#Verdict Execution timeMemoryGrader output
Fetching results...