QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#174731 | #7179. Fischer's Chess Guessing Game | ucup-team1631 | AC ✓ | 99ms | 11140kb | C++20 | 2.6kb | 2023-09-10 12:47:05 | 2023-09-10 12:47:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
#define all(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
template<class T>
bool chmax(T& p, T q, bool C = 1) {
if (C == 0 && p == q) {
return 1;
}
if (p < q) {
p = q;
return 1;
}
else {
return 0;
}
}
template<class T>
bool chmin(T& p, T q, bool C = 1) {
if (C == 0 && p == q) {
return 1;
}
if (p > q) {
p = q;
return 1;
}
else {
return 0;
}
}
vector<string> HAICHI;
ll sm(string A, string B) {
ll res = 0;
rep(i, A.size()) {
if (A[i] == B[i])res++;
}
return res;
}
int main() {
string P = "RRRQBBNN";
sort(all(P));
do {
string H = P;
vll knight;
ll R = 0;
rep(i, 8) {
if (H[i] == 'R') {
R++;
if (R == 2)H[i] = 'K';
}
if (H[i] == 'B') {
knight.push_back(i);
}
}
if ((knight[0] + knight[1]) % 2 == 1) {
HAICHI.push_back(H);
}
} while (next_permutation(all(P)));
vvll smH(960, vll(960));
rep(i, 960)rep(j, 960)smH[i][j] = sm(HAICHI[i], HAICHI[j]);
string SS;
cin>>SS;
while(SS[0]=='G') {
ll gamid;
cin>>gamid;
vll kouho(960);
rep(i, 960)kouho[i] = i;
rep(t, 6) {
vll NK;
ll siz = kouho.size();
ll cid = 0;
ll MM = 1e18;
rep(i, siz) {
vll DP(9, 0);
rep(j, siz) {
DP[smH[kouho[i]][kouho[j]]]++;
}
ll MA = -1;
rep(k, 9) {
chmax(MA, DP[k]);
}
if (chmin(MM, MA))cid = kouho[i];
}
if(t==0)cid=43;
string FM = HAICHI[cid];
cout << FM<<"\n";
fflush(stdout);
ll sam;
cin>>sam;
//cin >> sam;
//sam=sm(HAICHI[0],FM);
//cout<<sam<<endl;
//if(sam==0)break;
if (sam == 8)break;
for (auto k : kouho) {
if (smH[cid][k] == sam)NK.push_back(k);
}
kouho = NK;
if(kouho.size()==0)return 0;
//if(t==5&&kouho.size()!=1)return 0;
//cout<<NK.size()<<endl;
}
cin>>SS;
}
return 0;
//return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 13ms
memory: 10844kb
input:
GAME 1 2 0 4 1 8 END
output:
BBRQNKNR BRNNQBKR RKBBNRNQ RBBKNNRQ RKRBBQNN
result:
ok (c) correct after 1 tests, max moves 5 (1 test case)
Test #2:
score: 0
Accepted
time: 89ms
memory: 11100kb
input:
GAME 1 2 0 4 1 8 GAME 2 1 0 3 1 3 8 GAME 3 2 0 5 6 8 GAME 4 1 0 2 2 2 8 GAME 5 2 0 4 2 1 8 GAME 6 2 0 5 8 GAME 7 3 4 1 4 8 GAME 8 1 0 2 4 3 8 GAME 9 2 2 0 4 8 GAME 10 3 2 0 4 8 GAME 11 2 1 2 0 2 8 GAME 12 1 1 2 1 1 8 GAME 13 3 4 1 3 3 8 GAME 14 1 0 1 2 8 GAME 15 2 2 2 1 0 8 GAME 16 3 2 1 2 4 8 GAME ...
output:
BBRQNKNR BRNNQBKR RKBBNRNQ RBBKNNRQ RKRBBQNN BBRQNKNR NQBRKRNB RNNBBQKR RNKNQBBR RBNKBNRQ RKRBBNQN BBRQNKNR BRNNQBKR RKBBNRNQ RKRBNNBQ RKRBBNNQ BBRQNKNR NQBRKRNB RNNBBQKR QNRKBBRN RBKNBNRQ RKRBQNBN BBRQNKNR BRNNQBKR RKBBNRNQ RBBKNNRQ RNBQKRNB RKRBNQBN BBRQNKNR BRNNQBKR RKBBNRNQ RKRBNNBQ BBRQNKNR BNR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #3:
score: 0
Accepted
time: 83ms
memory: 10832kb
input:
GAME 1 2 1 2 2 1 8 GAME 2 2 2 2 4 5 8 GAME 3 1 0 5 8 GAME 4 2 1 3 6 8 GAME 5 1 0 4 2 2 8 GAME 6 2 2 4 2 4 8 GAME 7 2 3 0 2 3 8 GAME 8 3 2 3 1 8 GAME 9 1 0 4 5 8 GAME 10 2 3 1 3 2 8 GAME 11 3 2 4 4 4 8 GAME 12 1 0 3 6 8 GAME 13 2 0 2 2 8 GAME 14 1 1 1 2 5 8 GAME 15 2 0 3 2 8 GAME 16 1 1 0 5 5 8 GAME ...
output:
BBRQNKNR BRNNQBKR NNRBKQBR BNQBRKRN NQRNBKRB RKQBBNNR BBRQNKNR BRNNQBKR QRKBNNBR NNRBBQKR RNNBBKQR RKNBBQNR BBRQNKNR NQBRKRNB RNNBBQKR RKNBBNQR BBRQNKNR BRNNQBKR NNRBKQBR RQKBNNBR RKQBNNBR BBRQNKNR NQBRKRNB RNNBBQKR QRNNBBKR RBNKBQRN RKNBQNBR BBRQNKNR BRNNQBKR QRKBNNBR BRKBNRQN RQBBNNKR RKNBNQBR BBR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #4:
score: 0
Accepted
time: 86ms
memory: 10900kb
input:
GAME 1 1 2 3 2 1 8 GAME 2 0 2 3 4 8 GAME 3 1 3 4 8 GAME 4 1 3 5 8 GAME 5 1 4 2 3 8 GAME 6 0 3 3 1 8 GAME 7 1 1 2 3 8 GAME 8 0 2 2 8 GAME 9 1 2 4 2 4 8 GAME 10 1 2 6 5 8 GAME 11 0 3 2 5 8 GAME 12 1 3 4 4 8 GAME 13 2 2 3 8 GAME 14 1 0 1 5 8 GAME 15 2 2 4 4 8 GAME 16 3 4 1 8 GAME 17 1 0 0 6 8 GAME 18 2...
output:
BBRQNKNR NQBRKRNB QRKNNRBB NRQNBKRB RBQNKRBN QRKRBBNN BBRQNKNR NRBNKQRB RKQNBBRN NRQKRBBN NRKRBBQN BBRQNKNR NQBRKRNB RNKRBQNB NRKRBBNQ BBRQNKNR NQBRKRNB RNKRBQNB QRKRBNNB BBRQNKNR NQBRKRNB RQBKRNNB NNBRQKRB NRKRBQNB BBRQNKNR NRBNKQRB NRBKRBQN QNBRKBRN NRKRBNQB BBRQNKNR NQBRKRNB NRQNBBKR QRNBKNBR QRK...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #5:
score: 0
Accepted
time: 86ms
memory: 10848kb
input:
GAME 1 0 0 3 3 8 GAME 2 0 0 4 8 GAME 3 0 0 5 3 8 GAME 4 0 1 4 4 8 GAME 5 0 1 3 3 8 GAME 6 0 2 1 1 8 GAME 7 2 1 0 3 8 GAME 8 2 0 4 5 8 GAME 9 3 0 2 1 8 GAME 10 2 0 3 4 8 GAME 11 1 1 1 2 8 GAME 12 2 1 0 1 8 GAME 13 2 0 3 5 8 GAME 14 1 1 0 5 8 GAME 15 2 1 1 1 8 GAME 16 2 0 5 2 8 GAME 17 1 4 5 4 8 GAME ...
output:
BBRQNKNR NRBNKQRB RNKBRNBQ RNKRBBQN RQNKRBBN BBRQNKNR NRBNKQRB RNKBRNBQ RNQKRBBN BBRQNKNR NRBNKQRB RNKBRNBQ RNKBQRBN RNNKRBBQ BBRQNKNR NRBNKQRB QRNKRBBN RKNBRQBN RQNKRNBB BBRQNKNR NRBNKQRB QRNKRBBN RNNKBBRQ RNQKRNBB BBRQNKNR NRBNKQRB RKQNBBRN NRKBQRBN RNNKRQBB BBRQNKNR BRNNQBKR NNRBKQBR QBBNRKRN RBB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #6:
score: 0
Accepted
time: 95ms
memory: 10872kb
input:
GAME 1 1 1 2 2 2 8 GAME 2 0 4 3 8 GAME 3 1 2 2 1 4 8 GAME 4 1 2 4 3 8 GAME 5 0 5 5 5 8 GAME 6 1 3 2 4 3 8 GAME 7 0 2 4 8 GAME 8 0 3 5 8 GAME 9 0 3 4 8 GAME 10 0 3 2 4 8 GAME 11 0 4 1 5 8 GAME 12 0 5 3 8 GAME 13 4 1 3 2 8 GAME 14 3 2 4 3 8 GAME 15 3 2 5 3 8 GAME 16 3 1 3 1 8 GAME 17 2 4 3 2 8 GAME 18...
output:
BBRQNKNR NQBRKRNB NRQNBBKR QRNBKNBR BRKNQNRB QRBKNBRN BBRQNKNR NRBNKQRB RNBNKBRQ NRBKQBRN BBRQNKNR NQBRKRNB QRKNNRBB BRNBKRQN NRBNQBKR NRBKNBRQ BBRQNKNR NQBRKRNB QRKNNRBB RNQKNRBB QRBKNNRB BBRQNKNR NRBNKQRB NRBBKNRQ NQBRKNRB NRBKQNRB BBRQNKNR NQBRKRNB RNKRBQNB NQRKBNRB NNRKQRBB NRBKNQRB BBRQNKNR NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #7:
score: 0
Accepted
time: 99ms
memory: 10892kb
input:
GAME 1 3 3 5 8 GAME 2 1 3 1 4 2 8 GAME 3 2 1 1 2 4 8 GAME 4 1 2 3 2 8 GAME 5 2 1 2 1 1 8 GAME 6 1 2 3 1 8 GAME 7 1 5 4 3 8 GAME 8 0 2 2 1 8 GAME 9 1 4 3 2 8 GAME 10 1 6 5 8 GAME 11 2 0 4 2 8 GAME 12 0 4 5 4 8 GAME 13 0 1 3 2 4 8 GAME 14 0 1 2 6 8 GAME 15 0 1 2 8 GAME 16 0 3 0 6 8 GAME 17 0 3 0 8 GAM...
output:
BBRQNKNR BNRQKBRN BBQRKRNN RBBQKRNN BBRQNKNR NQBRKRNB RNKRBQNB QBNRKRBN BQNRKBRN RBBNKRQN BBRQNKNR BRNNQBKR NNRBKQBR BBQRKNRN NBBNRKRQ RBBNKRNQ BBRQNKNR NQBRKRNB QRKNNRBB NRQNBKRB RBQNKRBN BBRQNKNR BRNNQBKR NNRBKQBR BNQBRKRN RQKBBNNR RBNQKRBN BBRQNKNR NQBRKRNB QRKNNRBB NRQNBKRB RBNNKRBQ BBRQNKNR NQB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #8:
score: 0
Accepted
time: 93ms
memory: 11140kb
input:
GAME 1 1 1 2 8 GAME 2 1 2 2 3 8 GAME 3 1 2 2 4 8 GAME 4 1 1 4 4 8 GAME 5 1 2 3 4 8 GAME 6 2 4 2 4 2 8 GAME 7 5 3 8 GAME 8 3 4 3 4 8 GAME 9 4 1 4 8 GAME 10 3 4 2 1 8 GAME 11 2 1 4 8 GAME 12 3 4 3 5 8 GAME 13 3 3 4 1 8 GAME 14 4 1 5 4 8 GAME 15 2 2 0 1 8 GAME 16 2 1 3 1 5 8 GAME 17 3 4 1 2 8 GAME 18 2...
output:
BBRQNKNR NQBRKRNB NRQNBBKR QRNBKNBR BBRQNKNR NQBRKRNB QRKNNRBB BRNBKRQN NRQBKNBR BBRQNKNR NQBRKRNB QRKNNRBB BRNBKRQN NRNBKQBR BBRQNKNR NQBRKRNB NRQNBBKR QNBNRBKR QRNNKBBR BBRQNKNR NQBRKRNB QRKNNRBB NRQNBKRB NRQNKBBR BBRQNKNR BRNNQBKR RQBNNBKR BNNRKBQR BNNBRQKR NRNQKBBR BBRQNKNR RBNQBKNR BBRQKRNN BBR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #9:
score: 0
Accepted
time: 92ms
memory: 10940kb
input:
GAME 1 3 1 1 3 8 GAME 2 3 1 2 4 8 GAME 3 2 1 3 2 8 GAME 4 2 2 4 0 8 GAME 5 2 1 4 1 8 GAME 6 2 2 2 3 8 GAME 7 2 2 2 2 8 GAME 8 2 2 1 2 8 GAME 9 1 4 1 4 8 GAME 10 1 2 2 2 8 GAME 11 1 4 1 3 8 GAME 12 1 3 2 1 5 8 GAME 13 4 3 1 2 8 GAME 14 2 2 0 5 8 GAME 15 3 1 1 1 8 GAME 16 2 1 0 5 5 8 GAME 17 3 3 2 5 8...
output:
BBRQNKNR BNRQKBRN BRNBNQKR NBRKBNQR QBBRKNNR BBRQNKNR BNRQKBRN BRNBNQKR NBBQRNKR NBBRKQNR BBRQNKNR BRNNQBKR NNRBKQBR RQKBNNBR NBBRKNQR BBRQNKNR BRNNQBKR QRKBNNBR BRKBNRQN QBNRKNBR BBRQNKNR BRNNQBKR NNRBKQBR BNRBKRQN NBQRKNBR BBRQNKNR BRNNQBKR QRKBNNBR NNRBBQKR NBNRKQBR BBRQNKNR BRNNQBKR QRKBNNBR NNR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #10:
score: 0
Accepted
time: 84ms
memory: 10908kb
input:
GAME 1 8 GAME 2 6 5 5 8 GAME 3 6 4 5 8 GAME 4 6 4 4 5 8 GAME 5 5 3 3 8 GAME 6 5 2 4 3 8 GAME 7 5 5 4 4 8 GAME 8 6 5 4 5 8 GAME 9 4 4 5 5 8 GAME 10 5 3 2 3 8 GAME 11 6 4 5 5 5 8 GAME 12 4 5 4 8 GAME 13 4 2 2 1 8 GAME 14 4 3 4 2 1 8 GAME 15 3 2 1 3 8 GAME 16 4 3 3 2 8 GAME 17 4 4 3 3 8 GAME 18 3 2 1 4...
output:
BBRQNKNR BBRQNKNR BBNQRKNR BBQRNKNR BBRNQKNR BBRQNKNR BBNQRKNR BBRQNKRN BBRNNKQR BBRQNKNR BBNQRKNR BBRQNKRN BBRKNQNR BQRBNKNR BBRQNKNR RBNQBKNR BBRQKRNN BNRBQKNR BBRQNKNR RBNQBKNR BBRNNQKR BBRKNRNQ BNRBNKQR BBRQNKNR RBNQBKNR BBNRQKNR NBBQRKNR QBRNBKNR BBRQNKNR BBNQRKNR BBQRNKNR BBRQKNNR NBRQBKNR BBR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #11:
score: 0
Accepted
time: 81ms
memory: 10892kb
input:
GAME 1 1 1 3 2 1 8 GAME 2 1 0 6 8 GAME 3 1 0 8 GAME 4 1 1 5 4 8 GAME 5 1 0 5 3 8 GAME 6 2 4 4 2 2 8 GAME 7 3 1 6 5 8 GAME 8 2 6 5 4 8 GAME 9 3 1 8 GAME 10 3 2 5 2 8 GAME 11 4 3 4 3 8 GAME 12 2 8 GAME 13 2 3 2 2 8 GAME 14 1 2 1 1 0 8 GAME 15 2 3 3 4 1 8 GAME 16 2 5 2 8 GAME 17 3 2 4 4 8 GAME 18 1 2 2...
output:
BBRQNKNR NQBRKRNB NRQNBBKR QRNNBKRB NNRKBBRQ RQNBBNKR BBRQNKNR NQBRKRNB RNNBBQKR RNQBBNKR BBRQNKNR NQBRKRNB RNNBBQKR BBRQNKNR NQBRKRNB NRQNBBKR NRNBBQKR RQNNBBKR BBRQNKNR NQBRKRNB RNNBBQKR RKNBBNQR RNQNBBKR BBRQNKNR BRNNQBKR RQBNNBKR NBBNQRKR QRKNNBBR RNNQBBKR BBRQNKNR BNRQKBRN BRNBNQKR BQNBNRKR BRQ...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Extra Test:
score: 0
Extra Test Passed