Submission #55035

# Submission time Handle Problem Language Result Execution time Memory
55035 2018-07-05T21:54:14 Z ksun48 Broken Device (JOI17_broken_device) C++14
8 / 100
105 ms 3984 KB
#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(48);
	static mt19937_64 mt2(4848);
	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);
	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(48);
	static mt19937_64 mt2(4848);
	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);
	for(int i = 0; i < N; i++){
		info[i % 60] = max(info[i % 60], message[i]);
	}

	return done(info, Y);
}

Compilation message

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 time Memory Grader output
1 Partially correct 60 ms 3056 KB Output is partially correct - L* = 14
2 Partially correct 75 ms 3448 KB Output is partially correct - L* = 14
3 Partially correct 62 ms 3600 KB Output is partially correct - L* = 14
4 Partially correct 85 ms 3600 KB Output is partially correct - L* = 14
5 Partially correct 80 ms 3600 KB Output is partially correct - L* = 15
6 Partially correct 78 ms 3600 KB Output is partially correct - L* = 14
7 Partially correct 60 ms 3744 KB Output is partially correct - L* = 14
8 Partially correct 64 ms 3744 KB Output is partially correct - L* = 14
9 Partially correct 60 ms 3744 KB Output is partially correct - L* = 14
10 Partially correct 56 ms 3744 KB Output is partially correct - L* = 15
11 Partially correct 105 ms 3744 KB Output is partially correct - L* = 14
12 Partially correct 60 ms 3744 KB Output is partially correct - L* = 14
13 Partially correct 74 ms 3744 KB Output is partially correct - L* = 14
14 Partially correct 55 ms 3744 KB Output is partially correct - L* = 14
15 Partially correct 61 ms 3744 KB Output is partially correct - L* = 14
16 Partially correct 57 ms 3744 KB Output is partially correct - L* = 14
17 Partially correct 60 ms 3744 KB Output is partially correct - L* = 14
18 Partially correct 77 ms 3744 KB Output is partially correct - L* = 14
19 Partially correct 64 ms 3744 KB Output is partially correct - L* = 14
20 Partially correct 81 ms 3744 KB Output is partially correct - L* = 14
21 Partially correct 84 ms 3744 KB Output is partially correct - L* = 14
22 Partially correct 61 ms 3744 KB Output is partially correct - L* = 14
23 Partially correct 57 ms 3744 KB Output is partially correct - L* = 14
24 Partially correct 62 ms 3744 KB Output is partially correct - L* = 14
25 Partially correct 57 ms 3744 KB Output is partially correct - L* = 14
26 Partially correct 55 ms 3744 KB Output is partially correct - L* = 14
27 Partially correct 67 ms 3744 KB Output is partially correct - L* = 14
28 Partially correct 50 ms 3744 KB Output is partially correct - L* = 14
29 Partially correct 49 ms 3752 KB Output is partially correct - L* = 14
30 Partially correct 52 ms 3752 KB Output is partially correct - L* = 15
31 Partially correct 53 ms 3872 KB Output is partially correct - L* = 15
32 Partially correct 59 ms 3968 KB Output is partially correct - L* = 14
33 Partially correct 59 ms 3968 KB Output is partially correct - L* = 15
34 Partially correct 54 ms 3968 KB Output is partially correct - L* = 14
35 Partially correct 51 ms 3984 KB Output is partially correct - L* = 14
36 Partially correct 57 ms 3984 KB Output is partially correct - L* = 15
37 Partially correct 48 ms 3984 KB Output is partially correct - L* = 14
38 Partially correct 56 ms 3984 KB Output is partially correct - L* = 14
39 Partially correct 60 ms 3984 KB Output is partially correct - L* = 14
40 Partially correct 67 ms 3984 KB Output is partially correct - L* = 14