Submission #231340

# Submission time Handle Problem Language Result Execution time Memory
231340 2020-05-13T11:31:02 Z bensonlzl Broken Device (JOI17_broken_device) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

typedef long long ll;

int usable[155], ans[155];

void Anna(int N, long long X, int K, int P[]){
	mt19937 rng(8537293);
	vector<int> v;
	for (int i = 0; i < N; ++i){
		usable[i] = 1;
		ans[i] = 0;
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	for (int i = 0; i < K; ++i){
		usable[P[i]] = 0;
	}
	for (int i = 0; i < N; i += 2){
		if (usable[v[i]] && usable[v[i+1]]){
			if (X%3 == 0){
				ans[v[i]] = 0;
				ans[v[i+1]] = 1;
			}
			else if (X%3 == 1){
				ans[v[i]] = 1;
				ans[v[i+1]] = 0;
			}
			else{
				ans[v[i]] = 1;
				ans[v[i+1]] = 1;
			} 
			X /= 3;
		}
		else if (usable[v[i]] && !usable[v[i+1]] && (X%3 == 1)){
			ans[v[i]] = 1;
			ans[v[i+1]] = 0;
			X /= 3;
		}
		else if (!usable[v[i]] && usable[v[i+1]] && (X%3 == 0)){
			ans[v[i]] = 1;
			ans[v[i+1]] = 1;
			X /= 3;
		}
		else{
			ans[v[i]] = ans[v[i+1]] = 0;
		}
	}
	for (int i = 0; i < N; ++i){
		Set(i,ans[i]);
	}
}



    

Compilation message

/tmp/ccQXmGo9.o: In function `main':
grader_bruno.cpp:(.text.startup+0x126): undefined reference to `Bruno(int, int*)'
collect2: error: ld returned 1 exit status