QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#303693 | #7179. Fischer's Chess Guessing Game | ucup-team2235# | WA | 49ms | 7228kb | C++17 | 1.2kb | 2024-01-12 21:12:15 | 2024-01-12 21:12:15 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int C=960;
int K,Q,R,B,N;
vector<string> s;
void dfs(string a){
if(a.length()==8){
int c=0;
for(int i=0;i<8;i++)
if(a[i]=='B')c^=i;
if(c&1)s.emplace_back(a);
return;
}
if(R==1&&!K)K++,dfs(a+'K'),K--;
if(!Q)Q++,dfs(a+'Q'),Q--;
if(!R||R==1&&K)R++,dfs(a+'R'),R--;
if(N<2)N++,dfs(a+'N'),N--;
if(B<2)B++,dfs(a+'B'),B--;
}
int ask(string s){
cout<<s<<endl;
int x; cin>>x;
return x;
}
int main(){
ios::sync_with_stdio(false);
dfs("");
vector d(C,vector<int>(C));
for(int i=0;i<C;i++)
for(int j=0;j<C;j++)
for(int k=0;k<8;k++)
d[i][j]+=s[i][k]==s[j][k];
string g; while(cin>>g){
if(g[0]=='E')break;
int x; cin>>x;
vector<int> p(C);
iota(p.begin(),p.end(),0);
while(1){
if(p.size()==1){ask(s[p[0]]); break;}
int f=C+1,r;
for(int i=0;i<C;i++){
vector<int> c(9);
for(int j:p)c[d[i][j]]++;
int m=*max_element(c.begin(),c.end());
if(m<f)f=m,r=i;
}
int x=ask(s[r]);
vector<int> v;
for(int i:p)if(d[i][r]==x)v.emplace_back(i);
p=v;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 7224kb
input:
GAME 1 3 0 4 4 0 8 END
output:
RQKNBBRN NRKQNBBR RKNQBRNB QRKBBRNN QRKNNRBB RKRBBQNN
result:
ok (c) correct after 1 tests, max moves 6 (1 test case)
Test #2:
score: -100
Wrong Answer
time: 49ms
memory: 7228kb
input:
GAME 1 3 0 4 4 0 8 GAME 2 3 0 3 1 8 GAME 3 2 2 1 2 0 8 GAME 4 2 0 2 2 2 8 GAME 5 2 0 1 4 8 GAME 6 1 3 5 2 8 GAME 7 4 2 1 2 8 GAME 8 5 5 5 8 GAME 9 4 3 1 0 8 GAME 10 2 3 2 0 2 8 GAME 11 3 0 5 3 8 GAME 12 3 0 4 1 2 8 GAME 13 3 4 4 4 8 GAME 14 4 1 4 3 8 GAME 15 3 3 2 1 2 8 GAME 16 1 4 3 3 8 GAME 17 2 0...
output:
RQKNBBRN NRKQNBBR RKNQBRNB QRKBBRNN QRKNNRBB RKRBBQNN RQKNBBRN NRKQNBBR RKNQBRNB QNNRBKRB RKRBBNQN RQKNBBRN NRKQBBNR QNNRBBKR QRKBRNBN QRKNNBBR RKRBBNNQ RQKNBBRN NRKQBBNR BNRNQKRB QBBRKNRN QRKRNBBN RKRBQNBN RQKNBBRN NRKQBBNR BNRNQKRB RNKBQRBN RKRBNQBN RQKNBBRN RQBKNNRB RKNBNQBR QRKNNRBB RKRBNNBQ RQK...
result:
wrong answer (i) illegal position "" (game 48, guess 2) (test case 48)