QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#65161#4670. How To Identify SelfT3alaadl3k2olyehymn3k#AC ✓4ms3380kbC++201.0kb2022-11-27 21:16:102022-11-27 21:16:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-27 21:16:14]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3380kb
  • [2022-11-27 21:16:10]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

bool query(string s) {
    cout << "? " << s << endl;
    bool f;
    cin >> f;
    return f == 1;
}

void answer(char s) {
    cout << "! " << s << endl;
    exit(0);
}

signed main() {
// initally it's a pawn
    if (query("d3"))//bishop,king,queen
    {
        if (query("a3"))//queen
        {
            query("a2");
            query("e2");
            answer('q');
        } else { //bishop , king is in e2
            if (query("a6")) { // bishop
                query("e2");
                answer('b');
            } else { // king
                query("e2");
                answer('k');
            }
        }
    } else //pawn, knight,rook
    {
        if (query("g3")) { // knight
            query("e2");
            answer('n');
        } else {
            if (query("e8"))//rook
            {
                query("e2");
                answer('r');
            } else
                answer('p');
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3320kb

input:

0
0
1
1

output:

? d3
? g3
? e8
? e2
! r

result:

ok you are r, used 4 steps

Test #2:

score: 0
Accepted
time: 2ms
memory: 3324kb

input:

0
0
0

output:

? d3
? g3
? e8
! p

result:

ok you are p, used 3 steps

Test #3:

score: 0
Accepted
time: 2ms
memory: 3292kb

input:

1
0
1
1

output:

? d3
? a3
? a6
? e2
! b

result:

ok you are b, used 4 steps

Test #4:

score: 0
Accepted
time: 1ms
memory: 3264kb

input:

0
1
1

output:

? d3
? g3
? e2
! n

result:

ok you are n, used 3 steps

Test #5:

score: 0
Accepted
time: 4ms
memory: 3380kb

input:

1
1
1
1

output:

? d3
? a3
? a2
? e2
! q

result:

ok you are q, used 4 steps

Test #6:

score: 0
Accepted
time: 4ms
memory: 3280kb

input:

1
0
0
1

output:

? d3
? a3
? a6
? e2
! k

result:

ok you are k, used 4 steps