QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#278131 | #5556. Diabolic Doofenshmirtz | jzh# | WA | 1ms | 3672kb | C++20 | 1.3kb | 2023-12-07 12:41:29 | 2023-12-07 12:41:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll glb_lst;
ll ask(ll x) {
ll ret;
printf("%lld\n", x);
fflush(stdout);
scanf("%lld", &ret);
glb_lst = ret;
return ret;
}
ll addask(ll &cur, ll x) {
cur += x;
return ask(cur);
}
void solve()
{
ll cur = 0;
ll lst, tmp, ans;
vector<pair<ll, ll>> pfactors;
lst = addask(cur, 1e12l);
tmp = addask(cur, 10);
ans = cur - (tmp - lst);
lst = glb_lst;
tmp = ans;
for (ll i=2; i*i <= tmp; i++) if (tmp % i == 0) {
ll cc = 0;
for (; tmp%i == 0; tmp/=i) cc++;
pfactors.emplace_back(i, cc);
}
if (tmp > 1) pfactors.emplace_back(tmp, 1);
for (auto [p, a]: pfactors) {
ll L = 0, R = a, M, maxM=0;
vector<ll> pp;
for (ll b=1, i=0; i<=a; i++, b*=p) pp.push_back(b);
for (; L<=R; ) {
M = (L+R)/2;
if (addask(cur, ans/pp[M]) == lst) {
maxM = M;
L = M+1;
}
else {
R = M-1;
}
lst = glb_lst;
}
ans /= pp[maxM];
}
printf("! %lld\n", ans);
}
int main()
{
solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3672kb
input:
output:
1000000000000
result:
wrong answer Token "1000000000000" doesn't correspond to pattern "[?!]"