QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#345337 | #7179. Fischer's Chess Guessing Game | installb | AC ✓ | 783ms | 4084kb | C++14 | 1.9kb | 2024-03-06 19:43:24 | 2024-03-06 19:43:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 800005;
vector <string> G,iG;
map <string,int> mp; int tot = 0;
void init1(){
string s = "BBKNNQRR";
do{
int pk; vector <int> pb,pr;
for(int i = 0;i < 8;i ++){
if(s[i] == 'B') pb.push_back(i);
if(s[i] == 'R') pr.push_back(i);
if(s[i] == 'K') pk = i;
}
if((pb[0] & 1) == (pb[1] & 1)) continue;
if(!(pr[0] < pk && pk < pr[1])) continue;
if(mp.find(s) != mp.end()) continue;
mp[s] = tot ++;
G.push_back(s);
}while(next_permutation(s.begin(),s.end()));
}
mt19937 rnd(time(0));
string SS;
int calc(string x,string y){ int r = 0; for(int i = 0;i < 8;i ++) if(x[i] == y[i]) r ++; return r; }
void solve(){
vector <string> H;
G = iG;
string lis[6];
for(int ti = 0;ti < 6;ti ++){
int anss = 109099;
if(G.size() == 1) break;
string cur;
if(ti > 0){
for(int x = 0;x < iG.size();x ++){
map <int,int> chk;
for(int i = 0;i < G.size();i ++) chk[calc(G[i],iG[x])] ++;
int mx = 0;
for(auto it = chk.begin();it != chk.end();it ++) mx = max(mx,it->second);
if(mx <= anss){
anss = mx;
cur = iG[x];
}
}
}
else{
cur = "NRBBNKQR";
}
cout << cur << endl;
int x;
cin >> x;
// x = calc(cur,SS);
// cout << x << ' ' << cur << ' ' << SS << ' ' << G.size() << endl;
if(x == 8) return;
for(int i = 0;i < G.size();i ++) if(calc(cur,G[i]) == x) H.push_back(G[i]);
G.swap(H); H.clear();
lis[ti] = cur;
}
cout << G[0] << endl;
int x;
cin >> x;
}
int main(){
ios::sync_with_stdio(false);
init1(); iG = G;
string str;
while(cin >> str){
if(str == "END") break;
int x; cin >> x;
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 9ms
memory: 3848kb
input:
GAME 1 1 5 4 1 8 END
output:
NRBBNKQR RKBBNQRN RQNBBKRN RQNNKRBB RKRBBQNN
result:
ok (c) correct after 1 tests, max moves 5 (1 test case)
Test #2:
score: 0
Accepted
time: 683ms
memory: 4008kb
input:
GAME 1 1 5 4 1 8 GAME 2 2 3 3 2 1 8 GAME 3 1 3 3 1 1 8 GAME 4 1 4 1 3 2 8 GAME 5 2 3 4 2 8 GAME 6 2 2 1 2 2 8 GAME 7 0 2 3 6 8 GAME 8 1 3 3 1 2 8 GAME 9 0 3 5 2 8 GAME 10 0 3 3 4 8 GAME 11 0 5 2 8 GAME 12 1 2 5 3 4 8 GAME 13 1 4 1 2 3 8 GAME 14 0 4 2 3 8 GAME 15 1 3 3 3 4 8 GAME 16 1 3 3 5 8 GAME 17...
output:
NRBBNKQR RKBBNQRN RQNBBKRN RQNNKRBB RKRBBQNN NRBBNKQR RNBBQKRN RQKBNNBR RKBRNBNQ RQNNKRBB RKRBBNQN NRBBNKQR RKBBNQRN RKNBQRBN RNKQNRBB RQNNKRBB RKRBBNNQ NRBBNKQR RKBBNQRN RNBNKQRB RQNKRNBB RQNNKRBB RKRBQNBN NRBBNKQR RNBBQKRN RQKBNNBR QNRBBKNR RKRBNQBN NRBBNKQR RNBBQKRN RNQKBBNR RBNNBKRQ RQNNKRBB RKR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #3:
score: 0
Accepted
time: 742ms
memory: 4076kb
input:
GAME 1 2 2 5 2 8 GAME 2 2 2 4 4 2 8 GAME 3 3 3 3 2 3 8 GAME 4 3 3 3 2 1 8 GAME 5 2 3 5 3 8 GAME 6 3 2 3 3 8 GAME 7 1 2 3 2 2 8 GAME 8 1 2 2 4 4 8 GAME 9 2 1 4 5 8 GAME 10 2 1 4 3 3 8 GAME 11 2 1 5 4 8 GAME 12 1 2 2 5 6 8 GAME 13 0 2 3 3 8 GAME 14 1 2 4 2 1 8 GAME 15 0 1 1 2 8 GAME 16 0 2 1 3 8 GAME ...
output:
NRBBNKQR RNBBQKRN RNQKBBNR RQNNKBBR RKQBBNNR NRBBNKQR RNBBQKRN RNQKBBNR RQNBKNBR RQNNKRBB RKNBBQNR NRBBNKQR RQBBKNRN BRKBQNNR RQNNKRBB RQNNBKRB RKNBBNQR NRBBNKQR RQBBKNRN BRKBQNNR RQNNKRBB RQNNBKRB RKQBNNBR NRBBNKQR RNBBQKRN RQKBNNBR RQNNBBKR RKNBQNBR NRBBNKQR RQBBKNRN NRNBKRBQ BRNBQNKR RKNBNQBR NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #4:
score: 0
Accepted
time: 762ms
memory: 3844kb
input:
GAME 1 1 1 4 0 8 GAME 2 3 1 0 2 8 GAME 3 2 0 3 3 0 8 GAME 4 1 0 0 2 1 8 GAME 5 2 0 4 3 1 8 GAME 6 3 1 0 0 8 GAME 7 2 1 2 0 1 8 GAME 8 2 2 1 0 1 8 GAME 9 3 0 0 2 8 GAME 10 2 0 4 5 8 GAME 11 2 1 2 2 1 8 GAME 12 3 0 0 3 8 GAME 13 2 2 1 0 0 8 GAME 14 3 3 5 0 8 GAME 15 2 1 0 1 0 8 GAME 16 1 1 3 3 0 8 GAM...
output:
NRBBNKQR RKBBNQRN RQKNBBNR RQNNKRBB QRKRBBNN NRBBNKQR RQBBKNRN QBRNNKBR RQBKRBNN NRKRBBQN NRBBNKQR RNBBQKRN BRKQNRNB QNRKBBNR RQNNKRBB NRKRBBNQ NRBBNKQR RKBBNQRN NNRKRBBQ RBNQBNKR RQNNKRBB QRKRBNNB NRBBNKQR RNBBQKRN BRKQNRNB RNKRQNBB RQNNKRBB NRKRBQNB NRBBNKQR RQBBKNRN QBRNNKBR RQBKRBNN NRKRBNQB NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #5:
score: 0
Accepted
time: 783ms
memory: 3852kb
input:
GAME 1 0 4 1 5 8 GAME 2 0 3 2 6 8 GAME 3 0 4 2 4 8 GAME 4 0 5 8 GAME 5 0 4 4 1 8 GAME 6 0 6 4 5 8 GAME 7 1 3 4 5 8 GAME 8 3 3 0 1 2 8 GAME 9 2 2 3 4 2 8 GAME 10 0 1 0 3 8 GAME 11 1 2 4 3 4 8 GAME 12 0 2 6 2 8 GAME 13 1 3 4 3 3 8 GAME 14 0 3 1 5 8 GAME 15 1 2 2 5 3 8 GAME 16 2 2 3 6 8 GAME 17 1 2 4 2...
output:
NRBBNKQR RKNNRQBB RNQNBKRB RQNNKBBR RQNKRBBN NRBBNKQR RKNNRQBB RQKNBBNR RNQKRNBB RNQKRBBN NRBBNKQR RKNNRQBB RNQNBKRB RQBKRBNN RNNKRBBQ NRBBNKQR RKNNRQBB RQNKRNBB NRBBNKQR RKNNRQBB RNQNBKRB RQNNBBKR RNQKRNBB NRBBNKQR RKNNRQBB RQNKBNRB RQNKRBBN RNNKRQBB NRBBNKQR RKBBNQRN RKNBQRBN RQBBKRNN RBBKQRNN NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #6:
score: 0
Accepted
time: 761ms
memory: 3852kb
input:
GAME 1 3 3 1 1 0 8 GAME 2 3 3 2 1 0 8 GAME 3 4 4 0 8 GAME 4 3 3 2 0 1 8 GAME 5 3 3 3 1 0 8 GAME 6 4 3 1 0 8 GAME 7 1 2 1 5 1 8 GAME 8 2 2 4 0 8 GAME 9 2 1 3 0 3 8 GAME 10 1 1 1 3 4 8 GAME 11 2 1 1 1 3 8 GAME 12 2 1 2 5 8 GAME 13 3 0 3 2 8 GAME 14 2 1 5 2 8 GAME 15 4 4 2 1 8 GAME 16 4 6 0 8 GAME 17 4...
output:
NRBBNKQR RQBBKNRN BRKBQNNR RQNNKBBR RQNNKRBB QRBKNBRN NRBBNKQR RQBBKNRN BRKBQNNR RQNNBBKR RQNNKRBB NRBKQBRN NRBBNKQR RQBKNBNR RQNBBKNR NRBKNBRQ NRBBNKQR RQBBKNRN BRKBQNNR RQNNBBKR RQNNKRBB QRBKNNRB NRBBNKQR RQBBKNRN BRKBQNNR RQNNKRBB RQNNKBBR NRBKQNRB NRBBNKQR RQBKNBNR RNBBQKNR RQNNBBKR NRBKNQRB NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #7:
score: 0
Accepted
time: 736ms
memory: 3844kb
input:
GAME 1 1 3 3 3 2 8 GAME 2 2 3 1 4 4 8 GAME 3 1 2 3 6 4 8 GAME 4 0 3 2 3 8 GAME 5 0 3 1 4 8 GAME 6 0 4 2 1 8 GAME 7 2 4 2 4 8 GAME 8 3 5 2 8 GAME 9 2 4 3 2 8 GAME 10 1 2 4 3 3 8 GAME 11 1 2 4 2 4 8 GAME 12 2 3 1 5 8 GAME 13 1 3 6 6 8 GAME 14 1 3 5 2 8 GAME 15 1 2 3 6 5 8 GAME 16 0 5 5 8 GAME 17 0 4 5...
output:
NRBBNKQR RKBBNQRN RKNBQRBN RNKQNRBB RQNNKBBR RBBQKRNN NRBBNKQR RNBBQKRN RQKBNNBR RNBBKNQR RQNNKRBB RBBNKRQN NRBBNKQR RKBBNQRN RNKNBRQB RBNNKRBQ RQNNKRBB RBBNKRNQ NRBBNKQR RKNNRQBB RQKNBBNR RNQKRNBB RBQNKRBN NRBBNKQR RKNNRQBB RQKNBBNR RBQKRNBN RBNQKRBN NRBBNKQR RKNNRQBB RNQNBKRB RQBKRBNN RBNNKRBQ NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #8:
score: 0
Accepted
time: 756ms
memory: 3812kb
input:
GAME 1 3 3 4 4 3 8 GAME 2 4 1 6 8 GAME 3 4 1 5 5 8 GAME 4 2 0 1 1 4 8 GAME 5 3 1 3 3 3 8 GAME 6 3 1 2 3 3 8 GAME 7 0 0 2 2 8 GAME 8 1 1 1 2 1 8 GAME 9 0 1 4 0 8 GAME 10 1 2 1 0 3 8 GAME 11 2 3 1 4 2 8 GAME 12 1 1 1 1 0 8 GAME 13 0 2 4 0 8 GAME 14 0 1 4 3 8 GAME 15 1 0 2 2 4 8 GAME 16 0 2 1 2 8 GAME ...
output:
NRBBNKQR RQBBKNRN BRKBQNNR RQNBNKBR RQNNKRBB QRNBKNBR NRBBNKQR RQBKNBNR NQRBKNBR NRQBKNBR NRBBNKQR RQBKNBNR NQRBKNBR RQNBKNBR NRNBKQBR NRBBNKQR RNBBQKRN BRKQNRNB NBRQBKNR RQNNKRBB QRNNKBBR NRBBNKQR RQBBKNRN QBRNNKBR RQBNNBKR RQNNKRBB NRQNKBBR NRBBNKQR RQBBKNRN QBRNNKBR RQNNBBKR RQNNKRBB NRNQKBBR NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #9:
score: 0
Accepted
time: 583ms
memory: 4084kb
input:
GAME 1 2 1 1 1 0 8 GAME 2 3 2 2 2 1 8 GAME 3 4 2 2 1 8 GAME 4 1 0 1 4 8 GAME 5 2 0 0 8 GAME 6 2 0 0 6 3 8 GAME 7 2 2 4 2 0 8 GAME 8 3 3 2 3 2 8 GAME 9 4 3 3 4 8 GAME 10 1 0 3 3 3 8 GAME 11 2 0 0 5 4 8 GAME 12 2 1 4 1 2 8 GAME 13 3 4 1 1 8 GAME 14 2 6 2 4 8 GAME 15 3 3 0 4 2 8 GAME 16 1 3 2 5 8 GAME ...
output:
NRBBNKQR RNBBQKRN RNNKQBBR RBKNBRQN RQNNBKRB QBBRKNNR NRBBNKQR RQBBKNRN NRNBKRBQ RQNBKNBR RQNNKRBB NBBRKQNR NRBBNKQR RQBKNBNR RQNBBNKR RQBBNKRN NBBRKNQR NRBBNKQR RKBBNQRN NNRKRBBQ QBBNRNKR QBNRKNBR NRBBNKQR RNBBQKRN BRKQNRNB NBQRKNBR NRBBNKQR RNBBQKRN BRKQNRNB NBQRKNBR RQNNKRBB NBNRKQBR NRBBNKQR RNB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #10:
score: 0
Accepted
time: 630ms
memory: 4024kb
input:
GAME 1 3 0 4 5 8 GAME 2 2 2 2 2 2 8 GAME 3 4 2 1 2 8 GAME 4 4 4 5 2 8 GAME 5 3 1 3 1 1 8 GAME 6 5 3 3 8 GAME 7 2 1 1 3 0 8 GAME 8 3 0 5 2 8 GAME 9 4 1 3 3 8 GAME 10 3 0 4 8 GAME 11 4 2 1 3 8 GAME 12 3 0 4 6 8 GAME 13 3 1 4 0 8 GAME 14 4 3 4 3 8 GAME 15 5 2 4 8 GAME 16 4 2 2 3 8 GAME 17 5 5 2 8 GAME ...
output:
NRBBNKQR RQBBKNRN RBQNBKNR QBRNNKBR BBRQNKNR NRBBNKQR RNBBQKRN RNQKBBNR RQBNKRNB RQNNKBBR BBRNQKNR NRBBNKQR RQBKNBNR RQNBBNKR RNQKNBBR BBRNNKQR NRBBNKQR RQBKNBNR RQNBBKNR RQNKNRBB BQRBNKNR NRBBNKQR RQBBKNRN QBRNNKBR RQBNNBKR RQNNBBKR BNRBQKNR NRBBNKQR RQKBNNBR BRNBQNKR BNRBNKQR NRBBNKQR RNBBQKRN RNN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #11:
score: 0
Accepted
time: 745ms
memory: 3816kb
input:
GAME 1 2 2 3 3 4 8 GAME 2 2 3 4 4 8 GAME 3 2 3 3 1 2 8 GAME 4 1 1 6 4 8 GAME 5 1 1 5 4 8 GAME 6 1 1 4 2 4 8 GAME 7 4 2 4 0 8 GAME 8 3 2 3 8 GAME 9 4 2 4 1 8 GAME 10 3 0 3 1 8 GAME 11 3 0 1 4 8 GAME 12 2 1 4 2 2 8 GAME 13 5 4 2 8 GAME 14 5 3 6 8 GAME 15 6 1 1 8 GAME 16 4 4 1 1 8 GAME 17 5 2 1 8 GAME ...
output:
NRBBNKQR RNBBQKRN RNQKBBNR RQBKRNNB RQNNBKRB RQNBBNKR NRBBNKQR RNBBQKRN RQKBNNBR QNRBBKNR RNQBBNKR NRBBNKQR RNBBQKRN RQKBNNBR RKBRNBNQ RQNNKRBB RNNBBQKR NRBBNKQR RKBBNQRN RQKNBBNR RQNNKRBB RQNNBBKR NRBBNKQR RKBBNQRN RQKNBBNR RQNNKBBR RNQNBBKR NRBBNKQR RKBBNQRN RQKNBBNR RQNNKRBB RQNNKBBR RNNQBBKR NRB...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Extra Test:
score: 0
Extra Test Passed