Submission #1107530

#TimeUsernameProblemLanguageResultExecution timeMemory
1107530andrei_c1Magic Show (APIO24_show)C++17
0 / 100
2 ms804 KiB
#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 = 27; ll x = setN(kN); vector<pair<int, int>> edg; auto addEdge = [&](int u, int v) -> void { edg.emplace_back(u, 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); } random_shuffle(edg.begin(), edg.end()); 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 kSeed = 27; sort(edg.begin(), edg.end()); auto contains = [&](int u, int v) -> bool { return binary_search(edg.begin(), edg.end(), make_pair(u, 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...