QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#747063 | #5309. Guess Cycle Length | Nelofus | WA | 9ms | 3664kb | C++20 | 1.0kb | 2024-11-14 16:15:59 | 2024-12-15 15:52:36 |
Judging History
answer
/* Code by Heratino & Nelofus */
// No I still can't seem to
// Sing more than blues when it's time for my verse
// It's true that I need you
// To turn my blues into bursting fireworks
#include <bits/stdc++.h>
using i64 = long long;
std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
std::uniform_int_distribution<i64> gen(1, (int)1e9);
int main() {
auto walk = [&](i64 x) -> i64 {
std::cout << "walk " << x << std::endl;
std::cin >> x;
return x;
};
auto guess = [&](i64 x) -> void {
std::cout << "guess " << x << std::endl;
};
i64 m = 0, lst;
std::map<i64, i64> mp;
for (int i = 1; i <= 3333; i++)
lst = walk(gen(rng)), m = std::max(lst, m);
mp[lst] = 0;
for (int i = 1; i <= 3333; i++) {
i64 t = walk(1);
if (mp.count(t)) {
guess(i - 1);
return 0;
}
mp[t] = i;
}
i64 cnt = m;
walk(m);
for (int i = 1; i <= 3333; i++) {
i64 t = walk(3333);
cnt += 3333;
if (mp.count(t)) {
guess(cnt - mp[t]);
return 0;
}
}
assert(0);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 9ms
memory: 3664kb
input:
8 3 4 7 9 1 2 9 2 8 7 10 4 5 8 2 3 3 1 5 7 7 10 7 7 4 1 7 7 1 3 2 3 1 4 4 6 1 1 10 3 10 6 7 8 8 2 9 6 5 3 1 7 5 5 1 9 1 10 10 2 10 1 1 7 2 7 1 1 3 5 4 5 6 2 9 9 4 7 8 8 10 2 2 3 9 3 4 6 9 3 3 3 6 5 7 2 3 5 8 5 7 1 10 5 5 3 4 6 3 8 7 8 1 5 4 7 8 1 5 1 1 1 6 10 9 8 10 4 1 7 4 2 2 8 2 8 9 7 5 10 9 3 9 ...
output:
walk 744240655 walk 96557675 walk 732223513 walk 75760149 walk 560869886 walk 156419176 walk 854981583 walk 907380371 walk 44872199 walk 608167808 walk 262319557 walk 966770049 walk 624573392 walk 937506243 walk 914605649 walk 556605032 walk 420179753 walk 223769850 walk 620171074 walk 430509182 wal...
result:
wrong answer Wrong answer n=10, guessed=9