답안 #1107537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1107537 2024-11-01T12:07:32 Z andrei_c1 마술쇼 (APIO24_show) C++17
0 / 100
4 ms 1060 KB
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector<pair<int, int>> Alice() {
	const int kBits = 60;
	const int kBuc = 83;
	const int kN = kBits * kBuc + 2;
	const int kSeed = 3141241;
	ll x = setN(kN);
	vector<pair<int, int>> edg;
	array<int, kN + 1> ord;
	iota(ord.begin() + 1, ord.end(), 1);
	shuffle(ord.begin() + 1, ord.end(), default_random_engine(kSeed));
	auto addEdge = [&](int u, int v) -> void {
		edg.emplace_back(ord[u], ord[v]);
	};
	addEdge(1, 2);
	int u = 3;
	mt19937 rng(kSeed);
	auto addBit = [&](int i) -> void {
		bool b = x >> i & 1ll;
		for(int _ = 0; _ < kBuc; _++) {
			uint32_t rval = rng();
			addEdge(u, (rval + b) % (u - 1) + 1);
			u++;
		}
	};
	for(int i = 0; i < kBits; i++) {
		addBit(i);
	}
	shuffle(edg.begin(), edg.end(), default_random_engine(kSeed));
	return edg;
}
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll Bob(vector<pair<int, int>> edg){
	const int kBits = 60;
	const int kBuc = 83;
	const int kN = kBits * kBuc + 2;
	const int kSeed = 3141241;
	sort(edg.begin(), edg.end());
	array<int, kN + 1> ord;
	iota(ord.begin() + 1, ord.end(), 1);
	shuffle(ord.begin() + 1, ord.end(), default_random_engine(kSeed));
	auto contains = [&](int u, int v) -> bool {
		return binary_search(edg.begin(), edg.end(), make_pair(ord[u], ord[v]));
	};
	int u = 3;
	ll x = 0;
	mt19937 rng(kSeed);
	auto findBit = [&]() -> ll {
		ll res = 0;
		for(int _ = 0; _ < kBuc; _++) {
			uint32_t rval = rng();
			for(bool b : {false, true}) {
				if(contains(u, (rval + b) % (u - 1) + 1)) {
					res = b;
				}
			}
			u++;
		}
		return res;
	};
	for(int i = 0; i < kBits; i++) {
		x |= findBit() << i;
	}
	return x;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1060 KB Correct.
2 Incorrect 4 ms 1020 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1060 KB Correct.
2 Incorrect 4 ms 1020 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1060 KB Correct.
2 Incorrect 4 ms 1020 KB Incorrect answer.
3 Halted 0 ms 0 KB -