Submission #294540

# Submission time Handle Problem Language Result Execution time Memory
294540 2020-09-09T04:13:53 Z nandonathaniel Broken Device (JOI17_broken_device) C++14
Compilation error
0 ms 0 KB
#include "anna.h"
#include "bits/stdc++.h"
using namespace std;
int rusak[150],bits[65],ans[150];

// 100 -> "0"
// 001 -> "1"
// 110 -> "1"
// 010 -> "00"
// 011 -> "01"
// 101 -> "10"
// 111 -> "11"

void Anna( int N, long long X, int K, int P[] ){
	memset(rusak,0,sizeof(rusak));
	for(int i=0;i<K;i++)rusak[P[i]]=1;
	for(int i=0;i<63;i++){
		if(X & (1LL<<i))bits[i]=1;
		else bits[i]=0;
	}
	int j=0;
	for(int i=0;i<N;i+=3){
		int byk=rusak[i]+rusak[i+1]+rusak[i+2];
		if(byk>1){
			ans[i]=0;ans[i+1]=0;ans[i+2]=0;
			continue;
		}
		if(byk==0){
			if(bits[j]==0 && bits[j+1]==0){
				ans[i]=0;ans[i+1]=1;ans[i+2]=0;
			}
			else if(bits[j]==0 && bits[j+1]==1){
				ans[i]=0;ans[i+1]=1;ans[i+2]=1;
			}
			else if(bits[j]==1 && bits[j+1]==0){
				ans[i]=1;ans[i+1]=0;ans[i+2]=1;
			}
			else{
				ans[i]=1;ans[i+1]=1;ans[i+2]=1;
			}
			j+=2;
		}
		else{
			if(bits[j]==0){
				if(!rusak[i]){
					ans[i]=1;ans[i+1]=0;ans[i+2]=0;
					j++;
				}
				else{
					if(bits[j+1]==0){
						ans[i]=0;ans[i+1]=1;ans[i+2]=0;
					}
					else{
						ans[i]=0;ans[i+1]=1;ans[i+2]=1;
					}
					j+=2;
				}
			}
			else{
				if(!rusak[i+2]){
					ans[i]=0;ans[i+1]=0;ans[i+2]=1;
				}
				else{
					ans[i]=1;ans[i+1]=1;ans[i+2]=0;
				}
				j++;
			}
		}
	}
	for(int i=0;i<N;i++)Set(i,ans[i]);
}
#include "bruno.h"
#include "bits/stdc++.h"
using namespace std;

// 100 -> "0"
// 001 -> "1"
// 110 -> "1"
// 010 -> "00"
// 011 -> "01"
// 101 -> "10"
// 111 -> "11"

long long Bruno( int N, int A[] ){
	vector<int> bits;
	for(int i=0;i<N;i+=3){
		if(A[i]==1 && A[i+1]==0 && A[i+2]==0){
			bits.push_back(0);
		}
		else if(A[i]==0 && A[i+1]==0 && A[i+2]==1){
			bits.push_back(1);
		}
		else if(A[i]==1 && A[i+1]==1 && A[i+2]==0){
			bits.push_back(1);
		}
		else if(A[i]==0 && A[i+1]==1 && A[i+2]==0){
			bits.push_back(0);bits.push_back(0);
		}
		else if(A[i]==0 && A[i+1]==1 && A[i+2]==1){
			bits.push_back(0);bits.push_back(1);
		}
		else if(A[i]==1 && A[i+1]==0 && A[i+2]==1){
			bits.push_back(1);bits.push_back(0);
		}
		else if(A[i]==1 && A[i+1]==1 && A[i+2]==1){
			bits.push_back(1);bits.push_back(1);
		}
	}
	long long ans=0;
	for(int i=0;i<60;i++){
		if(bits[i])ans+=(1LL<<i);
	}
	return ans;
}

Compilation message

Anna.cpp:1:10: fatal error: anna.h: No such file or directory
    1 | #include "anna.h"
      |          ^~~~~~~~
compilation terminated.

Bruno.cpp:1:10: fatal error: bruno.h: No such file or directory
    1 | #include "bruno.h"
      |          ^~~~~~~~~
compilation terminated.