Submission #1107643

# Submission time Handle Problem Language Result Execution time Memory
1107643 2024-11-01T19:23:59 Z andrei_c1 Magic Show (APIO24_show) C++17
0 / 100
3 ms 1064 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;
	const int kMod = 1235141242;
	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; _++) {
			int rval = rng() % kMod;
			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;
	const int kMod = 1235141242;
	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; _++) {
			int rval = rng() % kMod;
			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;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1060 KB Correct.
2 Incorrect 2 ms 1064 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1060 KB Correct.
2 Incorrect 2 ms 1064 KB Incorrect answer.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1060 KB Correct.
2 Incorrect 2 ms 1064 KB Incorrect answer.
3 Halted 0 ms 0 KB -