QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#401200 | #5156. Going in Circles | ucup-team1716# | WA | 10ms | 4000kb | C++20 | 1.2kb | 2024-04-28 07:08:19 | 2024-04-28 07:08:19 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int pos = 0, cur = 1, dir = 1, l = 0, r = 0;
map<int, int> a;
int x;
cin >> x;
a[0] = x;
bool cont = true;
while(true)
{
for(int i=0; i<cur; i++)
{
//cout << pos << "\n";
if(dir==1)
{
cout << "? right\n";
cout.flush();
}
else
{
cout << "? left\n";
cout.flush();
}
pos += dir;
l = min(l, pos);
r = max(r, pos);
cin >> x;
if(a.find(pos) == a.end()) a[pos] = x;
else if(a[pos] != x)
{
cont = false;
break;
}
}
if(!cont) break;
cout << "? flip\n";
cout.flush();
cin >> x;
a[pos] = x;
cur = 2 * cur + 1;
dir *= -1;
}
if(dir==1) cout << "! " << pos - l << "\n";
else cout << "! " << r - pos << "\n";
cout.flush();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 10ms
memory: 4000kb
input:
0 1 0 0 1 0 1 1 0 0 0 0 1 0 1 1 0 0 0 0 1 1 1 0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 0 0 0 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 ...
output:
? right ? flip ? left ? left ? left ? flip ? right ? right ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? left ? flip ? right ? right ? right ? right ? right ? right ? right ? right ? right ? right ? ...
result:
wrong answer Wrong answer: correct guess, but used too many queries. Queries used: 21382 (5882 too many)