QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#116768 | #5156. Going in Circles | batrr# | WA | 1ms | 3400kb | C++23 | 2.0kb | 2023-06-30 02:41:57 | 2023-06-30 02:41:58 |
Judging History
answer
#include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const int N = 300500, inf = 1e9, mod = 998244353;
const ll INF = 1e18;
int sum(int a, int b) {
a += b;
if (a >= mod)
a -= mod;
return a;
}
int sub(int a, int b) {
a -= b;
if (a < 0)
a += mod;
return a;
}
int mult(int a, int b) {
return 1ll * a * b % mod;
}
int bp(int a, int b) {
int res = 1;
while (b) {
if (b & 1)
res = mult(res, a);
a = mult(a, a);
b >>= 1;
}
return res;
}
int inv(int x) {
return bp(x, mod - 2);
}
void gogo(int dir)
{
if (dir==1) cout << "? " << "left" << endl;
else cout << "? " << "right" << endl;
}
void flip()
{
cout << "? flip" << endl;
}
void fin(int n)
{
cout << "! " << n << endl;
exit(0);
}
void solve() {
int dir = -1;
for (int k=0;;k++)
{
dir = -dir;
int k2 = (1<<k);
for (int i=0;i<(1<<k);i++)
{
int x;
cin >> x;
if (i==0)
{
if (x!=1)
{
flip();
cin >> x;
}
gogo(dir);
continue;
}
if (x==1)
{
if (i<=k2/2 and i>=3)
{
fin(i);
}
if (i!=0)
{
flip();
cin >> x;
}
}
gogo(dir);
}
}
}
int main() {
//#ifdef DEBUG
// freopen("input.txt", "r", stdin);
//#endif
ios_base::sync_with_stdio(false);
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++) {
// cout << "Case #" << i << endl;
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3400kb
input:
0 1 1 1 0 1 0 1 0 0 1 0 0 0 1
output:
? flip ? left ? right ? flip ? right ? left ? left ? flip ? left ? left ? right ? right ? right ? right ! 4
result:
wrong answer Wrong answer: incorrect guess 4 (ans: 5000). Queries used: 14