Submission #1215540

#TimeUsernameProblemLanguageResultExecution timeMemory
1215540GrayBroken Device (JOI17_broken_device)C++20
41 / 100
23 ms1512 KiB
#include "Annalib.h"
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    map<ll, ll> unfree;
    for (ll i=0; i<K; i++){
        unfree[P[i]]=1;
    }
    vector<ll> nums;
    for (ll i=0; i<60; i++){
        if ((1ull<<i)&X) nums.push_back(1);
        else nums.push_back(0);
    }
    reverse(nums.begin(), nums.end());
    for (ll i=1; i<N; i+=2){
        if (unfree.count(i) or unfree.count(i-1) or nums.empty()){
            Set(i, 0); Set(i-1, 0);
        }else{
            Set(i, 1); Set(i-1, nums.back());
            nums.pop_back();
        }
    }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;

long long Bruno( int N, int A[] ){
    vector<ll> nums;
    // for (ll i=0; i<N; i++) cout << A[i] << endl;
    for (ll i=1; i<N and nums.size()<60; i+=2){
        if (A[i]==0 and A[i-1]==0) continue;
        else{
            nums.push_back(A[i-1]);
        }
    }
    ll x=0;
    for (ll i=0; i<60; i++){
        if (nums[i]) x+=(1ull<<i);
    }
  return x;
}
#Verdict Execution timeMemoryGrader output
Fetching results...