QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#151420 | #5556. Diabolic Doofenshmirtz | Shulker_ | WA | 2ms | 3664kb | C++23 | 988b | 2023-08-26 17:10:19 | 2023-08-26 17:10:20 |
Judging History
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 "[?!]"