QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#278132#5556. Diabolic Doofenshmirtzjzh#WA 1ms3676kbC++201.2kb2023-12-07 12:43:242023-12-07 12:43:25

Judging History

你现在查看的是最新测评结果

  • [2023-12-07 12:43:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3676kb
  • [2023-12-07 12:43:24]
  • 提交

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);
    ans = cur - 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: 3676kb

input:


output:

1000000000000

result:

wrong answer Token "1000000000000" doesn't correspond to pattern "[?!]"