QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#151420#5556. Diabolic DoofenshmirtzShulker_WA 2ms3664kbC++23988b2023-08-26 17:10:192023-08-26 17:10:20

Judging History

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

  • [2023-08-26 17:10:20]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3664kb
  • [2023-08-26 17:10:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PII pair<ll,ll>
#define inf 0x3f3f3f3f
#define inff 0x3f3f3f3f3f3f3f3f
#define mem(a,b) memset(a,b,sizeof a)
#define endl '\n'
const ll N=1e6+5;
const double eps=1e-6;
const ll mod=998244353;
const double pi=3.141592653589;
const double ol=0.57721566490153286060651209;
ll n,m,k;
ll ask(ll x)
{
    cout<<"? "<<x<<endl;
    ll pp;cin>>pp;
    return pp;
}
void solve()
{
    cout<<"? 1"<<endl;
    ll x;
    cin>>x;
    if(x==0)
    {
        cout<<1<<endl;return ;
    }
    ll now=2;
    ll last=1;
    ll pp=0;
    while((pp=ask(now))>last)
    {
        now*=2;
        last*=2;
    }

    cout<<"! "<<now-pp<<endl;

/*65
1 1
2 2
4 4
8 8
16 16
32 32
64 64
128 63*/
}
int main(){
    //ios::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0) ;
    ll tt = 1 ;
    //cin>>tt;
    while(tt--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3508kb

input:

1
2
4
8
16
32
22

output:

? 1
? 2
? 4
? 8
? 16
? 32
? 64
! 42

result:

ok Queries used: 8

Test #2:

score: 0
Accepted
time: 2ms
memory: 3600kb

input:

1
2
4
8
16
32
64
128
256
512
1024
711

output:

? 1
? 2
? 4
? 8
? 16
? 32
? 64
? 128
? 256
? 512
? 1024
? 2048
! 1337

result:

ok Queries used: 13

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3664kb

input:

0

output:

? 1
1

result:

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