Submission #55042

#TimeUsernameProblemLanguageResultExecution timeMemory
55042ksun48Broken Device (JOI17_broken_device)C++14
8 / 100
152 ms3968 KiB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

void done(vector<LL> message, vector<LL> perm){
	for(int i = 0; i < message.size(); i++){
		Set(i, message[perm[i]]);
	}
}

void Anna(int N, long long X, int K, int P[]){

	// shared initialization
	static mt19937_64 mt1(4848);
	static mt19937_64 mt2(484848);
	static LL B = 60;
	LL Y = mt1() & ((1LL << B) - 1);
	vector<LL> perm(N);
	for(int i = 0; i < N; i++){
		perm[i] = i;
	}
	for(int i = N-1; i >= 0; i--){
		int d = mt2() % (i+1);
		if(d < 0){
			d += (i+1);
		}
		swap(perm[i], perm[d]);
	}
	// shared initialization

	vector<LL> info(60);
	for(LL i = 0; i < 60; i++){
		info[i] = ((X ^ Y) >> i) & 1;
	}

	vector<LL> message(N, 0);
	// boilerplate
	// ----------------------------------

	for(int i = 0; i < N; i++){
		message[i] = info[i % 60];
	}

	// ----------------------------------
	done(message, perm);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

using namespace std;

LL done(vector<LL> info, LL b){
	LL a = 0;
	for(LL i = 0; i < 60; i++){
		a ^= info[i] << i;
	}
	return a ^ b;
}

long long Bruno(int N, int A[]){

	// shared initialization
	static mt19937_64 mt1(4848);
	static mt19937_64 mt2(484848);
	static LL B = 60;
	LL Y = mt1() & ((1LL << B) - 1);
	vector<LL> perm(N);
	for(int i = 0; i < N; i++){
		perm[i] = i;
	}
	for(int i = N-1; i >= 0; i--){
		int d = mt2() % (i+1);
		if(d < 0){
			d += (i+1);
		}
		swap(perm[i], perm[d]);
	}
	// shared initialization

	vector<LL> message(N);
	for(int i = 0; i < N; i++){
		message[perm[i]] = A[i];
	}

	vector<LL> info(60, 0);
	// boilerplate
	// ----------------------------------

	for(int i = 0; i < N; i++){
		info[i % 60] = max(info[i % 60], message[i]);
	}

	// ----------------------------------
	return done(info, Y);
}

Compilation message (stderr)

Anna.cpp: In function 'void done(std::vector<long long int>, std::vector<long long int>)':
Anna.cpp:7:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < message.size(); i++){
                 ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...