Submission #290659

# Submission time Handle Problem Language Result Execution time Memory
290659 2020-09-04T09:38:47 Z maximath_1 Broken Device (JOI17_broken_device) C++11
Compilation error
0 ms 0 KB
#include "annalib.h"
#include <string.h>
using namespace std;

int broken[155], ret[155], bit[65];
void Anna(int N, long long X, int K, int P[]){
	for(int i = 0; i <= 60; i ++)
		if((X >> i) & 1ll) bit[i] = 1;
		else bit[i] = 0;

	memset(broken, 0, sizeof(broken));
	memset(ret, 0, sizeof(ret));
	for(int i = 0; i < K; i ++)
		broken[P[i]] = 1;

	int it = 0;
	for(int i = 0; i < N && it < 60; i += 3){
		int cnt = broken[i] + broken[i + 1] + broken[i + 2];
		if(cnt == 0){
			if(bit[it + 1] == 0){
				if(bit[it] == 0){
					ret[i] = 1; ret[i + 1] = ret[i + 2] = 0;
				}else{
					ret[i] = 0; ret[i + 1] = ret[i + 2] = 1;
				}
			}else{
				if(bit[it] == 0){
					ret[i] = ret[i + 1] = 1; ret[i + 2] = 0;
				}else{
					ret[i] = ret[i + 1] = ret[i + 2] = 1;
				}
			}
			it += 2;
		}else if(cnt == 1){
			if(broken[i]){
				if(bit[it] == 0){
					ret[i] = ret[i + 1] = 0; ret[i + 2] = 1;
				}else{
					ret[i] = ret[i + 2] = 0; ret[i + 1] = 1;
				}
				it ++;
			}else if(broken[i + 1]){
				if(bit[it] == 0){
					ret[i] = ret[i + 1] = 0; ret[i + 2] = 1;
				}else{
					ret[i] = ret[i + 2] = 1; ret[i + 1] = 0;
				}
				it ++;
			}else{
				if(bit[it] == 1){
					ret[i] = ret[i + 2] = 0; ret[i + 1] = 1;
					it ++;
				}else{
					if(bit[it + 1] == 0){
						ret[i] = 1; ret[i + 1] = ret[i + 2] = 0;
					}else{
						ret[i] = ret[i + 1] = 1; ret[i + 2] = 0;
					}
					it += 2;
				}
			}
		}
	}

	for(int i = 0; i < N; i ++)
		Set(i, ret[i]);
}
#include "brunolib.h"
#include <iostream>
using namespace std;

int _bit[65];
long long Bruno(int N, int A[]){
	int it = 0;
	for(int i = 0; i < N && it < 60; i += 3){
		int gt = A[i] * 4 + A[i + 1] * 2 + A[i + 2];
		if(gt == 0){
			//nothing	
		}else if(gt == 1){
			_bit[it] = 0; it ++;
		}else if(gt == 2){
			_bit[it] = 1; it ++;
		}else if(gt == 3){
			_bit[it] = 1; _bit[it + 1] = 0;
			it += 2;
		}else if(gt == 4){
			_bit[it] = _bit[it + 1] = 0;
			it += 2;
		}else if(gt == 5){
			_bit[it] = 1; it ++;
		}else if(gt == 6){
			_bit[it] = 0; _bit[it + 1] = 1;
			it += 2;
		}else if(gt == 7){
			_bit[it] = _bit[it + 1] = 1;
			it += 2;
		}
	}

	long long ans = 0ll;
	for(int i = 0; i <= 60; i ++)
		if(_bit[i]) ans += (1ll << i);

	return ans;
}

Compilation message

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

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