QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#208007 | #5156. Going in Circles | Minhho | TL | 0ms | 0kb | C++20 | 1.1kb | 2023-10-09 03:23:30 | 2023-10-09 03:23:30 |
answer
#define taskname "G"
#include <bits/stdc++.h>
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);
checksmall();
int rnd = rng();
rnd = abs(rnd);
rnd %= (1ll<<30);
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, cnt = 0;
while (true)
{
cnt++;
cout<<l<<endl;
cin>>x;
cur %= (1ll<<29);
cur <<= 1;
cur |= x;
if (cur == rnd) return cout<<cnt, 0;
}
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
0
output:
left left