QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#208061 | #5156. Going in Circles | Minhho | WA | 0ms | 3664kb | C++20 | 1.6kb | 2023-10-09 04:57:22 | 2023-10-09 04:57:22 |
Judging History
answer
#define taskname "G"
#include <bits/stdc++.h>
#define int long long
using namespace std;
const string l = "? left", r = "? right", f = "? flip";
int x;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
void checksmall()
{
for (int i=1; i<=50; i++)
{
cout<<l<<endl;
cin>>x;
if (x) cout<<f<<endl, cin>>x;
}
cout<<f<<endl;
cin>>x;
for (int i=1; i<=50; i++)
{
cout<<r<<endl;
cin>>x;
if (x)
{
cout<<"! "<<i;
exit(0);
}
}
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
/**
int tmp = 1101 = 13
append 1
tmp %= (1<<3)
tmp <<= 1
tmp |= 1
**/
int tmp = 13;
tmp %= (1<<3);
tmp <<= 1;
tmp |= 1;
cout<<tmp;
cin>>x;
if (x) cout<<f<<endl, cin>>x;
checksmall();
int rnd = 0, rrnd = 0;
for (int i=0; i<30; i++)
{
int x = rng() & 1;
rnd += x * (1ll<<i);
if (i < 29) rrnd += x * (1ll<<i);
}
// cout<<rnd<<"\n";
// cout<<(rnd << 1) % (1ll << 30);
// cout<<rnd % (1ll<<29)<<" "<<rrnd<<" "<<(((rnd<<1) % (1ll<<30))|(rnd&1))<<"\n";
for (int i=0; i<30; i++)
{
cout<<l<<endl;
cin>>x;
if (x != (rnd >> (29-i) & 1)) cout<<f<<endl, cin>>x;
}
int cur = rnd;
for (int i=1; i<=1e5; i++)
{
cout<<l<<endl;
cin>>x;
cur = cur % (1ll<<29);
cur <<= 1;
cur |= x;
if (cur == rnd) return cout<<"! "<<i, 0;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3664kb
input:
0
output:
11? left
result:
wrong answer Wrong answer: invalid response type. Queries used: 0