QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#116768#5156. Going in Circlesbatrr#WA 1ms3400kbC++232.0kb2023-06-30 02:41:572023-06-30 02:41:58

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 02:41:58]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3400kb
  • [2023-06-30 02:41:57]
  • 提交

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();
    }
}

Details

Tip: Click on the bar to expand more detailed information

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