QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#115932 | #5313. Please Save Pigeland | PetroTarnavskyi# | WA | 9ms | 3396kb | C++17 | 1.2kb | 2023-06-27 19:03:02 | 2023-06-27 19:03:03 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
const int M = 1e9;
const int K1 = 2000;
const int K2 = 3000;
mt19937 rng;
LL s;
unordered_map<int, LL> mp;
LL n = -1;
int ask(int x) {
cout << "walk " << x << endl;
s += x;
int v;
cin >> v;
if (n == -1 && mp.count(v) && s != mp[v] && s - mp[v] < 2e9) {
n = s - mp[v];
}
mp[v] = s;
return v;
}
int main()
{
//ios::sync_with_stdio(false);
//cin.tie(0);
int mx = 0;
FOR(i, 0, K1) {
int x = rng() % M;
mx = max(mx, ask(x));
}
FOR(i, 0, K2) {
ask(K2);
}
ask(mx);
FOR(i, 0, K2) {
ask(1);
}
assert(n != -1);
int v = ask(0);
for (int p = 2; p * p <= n; p++) {
if (n % p == 0) {
while (n % p == 0) {
int u = ask(n / p);
if (u == v) {
n /= p;
}
v = u;
}
}
}
cout << "guess " << n << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 9ms
memory: 3396kb
input:
5 3 3 4 5 1 2 2 2 3 4 2 5 4 3 4 6
output:
walk 499211612 walk 581869302 walk 890346734 walk 586334585 walk 545404204 walk 161255391 walk 922919429 walk 949333985 walk 715962298 walk 323567403 walk 418932835 walk 350294565 walk 196140740 walk 809094426 walk 348838239 walk 264392720 walk 112460519 walk 279768804 walk 144164697 walk 156218106 ...
result:
wrong output format Expected integer, but "walk" found