Submission #100876

#TimeUsernameProblemLanguageResultExecution timeMemory
100876Pro_ktmrBroken Device (JOI17_broken_device)C++14
41 / 100
63 ms3312 KiB
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Annalib.h"

//void Set(int pos, int bit)
//N=150
void Anna(int N, long long X, int K, int P[]){
	bool canUse[150];
	for(int i=0; i<N; i++) canUse[i] = true;
	for(int i=0; i<K; i++) canUse[P[i]] = false;
	LL now = 0;
	for(int i=0; i<N; i++){
		if(i+1 < N && now < 60 && canUse[i] && canUse[i+1]){
			Set(i, 1);
			Set(i+1, (X>>now)%2);
			i++;
			now++;
		}
		else if(i+1 < N && now < 60 && canUse[i] && (X>>now)%2 == 0){
			Set(i, 1);
			Set(i+1, 0);
			i++;
			now++;
		}
		else{
			Set(i, 0);
		}
	}
}
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define MP make_pair
#include"Brunolib.h"

long long Bruno(int N, int A[]){
	LL ans = 0;
	LL now = 0;
	for(int i=0; i+1<N; i++){
		if(A[i] == 1){
			ans += ((LL)(A[i+1])<<now);
			i++;
			now++;
		}
	}
	return ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...