답안 #55042

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55042 2018-07-05T22:10:26 Z ksun48 Broken Device (JOI17_broken_device) C++14
8 / 100
152 ms 3968 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(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

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++){
                 ~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 54 ms 3056 KB Output is partially correct - L* = 14
2 Partially correct 49 ms 3416 KB Output is partially correct - L* = 14
3 Partially correct 60 ms 3568 KB Output is partially correct - L* = 14
4 Partially correct 55 ms 3568 KB Output is partially correct - L* = 14
5 Partially correct 57 ms 3568 KB Output is partially correct - L* = 15
6 Partially correct 59 ms 3576 KB Output is partially correct - L* = 14
7 Partially correct 54 ms 3576 KB Output is partially correct - L* = 14
8 Partially correct 152 ms 3576 KB Output is partially correct - L* = 14
9 Partially correct 52 ms 3712 KB Output is partially correct - L* = 16
10 Partially correct 55 ms 3712 KB Output is partially correct - L* = 14
11 Partially correct 55 ms 3712 KB Output is partially correct - L* = 14
12 Partially correct 84 ms 3712 KB Output is partially correct - L* = 14
13 Partially correct 57 ms 3712 KB Output is partially correct - L* = 14
14 Partially correct 49 ms 3744 KB Output is partially correct - L* = 14
15 Partially correct 59 ms 3744 KB Output is partially correct - L* = 14
16 Partially correct 53 ms 3744 KB Output is partially correct - L* = 14
17 Partially correct 49 ms 3744 KB Output is partially correct - L* = 14
18 Partially correct 59 ms 3744 KB Output is partially correct - L* = 14
19 Partially correct 65 ms 3744 KB Output is partially correct - L* = 14
20 Partially correct 57 ms 3744 KB Output is partially correct - L* = 14
21 Partially correct 55 ms 3744 KB Output is partially correct - L* = 14
22 Partially correct 57 ms 3744 KB Output is partially correct - L* = 14
23 Partially correct 56 ms 3960 KB Output is partially correct - L* = 14
24 Partially correct 67 ms 3960 KB Output is partially correct - L* = 14
25 Partially correct 60 ms 3960 KB Output is partially correct - L* = 14
26 Partially correct 59 ms 3968 KB Output is partially correct - L* = 14
27 Partially correct 52 ms 3968 KB Output is partially correct - L* = 14
28 Partially correct 53 ms 3968 KB Output is partially correct - L* = 14
29 Partially correct 57 ms 3968 KB Output is partially correct - L* = 14
30 Partially correct 53 ms 3968 KB Output is partially correct - L* = 14
31 Partially correct 56 ms 3968 KB Output is partially correct - L* = 14
32 Partially correct 51 ms 3968 KB Output is partially correct - L* = 16
33 Partially correct 55 ms 3968 KB Output is partially correct - L* = 14
34 Partially correct 115 ms 3968 KB Output is partially correct - L* = 14
35 Partially correct 58 ms 3968 KB Output is partially correct - L* = 14
36 Partially correct 53 ms 3968 KB Output is partially correct - L* = 14
37 Partially correct 51 ms 3968 KB Output is partially correct - L* = 14
38 Partially correct 56 ms 3968 KB Output is partially correct - L* = 14
39 Partially correct 54 ms 3968 KB Output is partially correct - L* = 14
40 Partially correct 51 ms 3968 KB Output is partially correct - L* = 14