QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#226522 | #7179. Fischer's Chess Guessing Game | acagubica | WA | 8ms | 3920kb | C++14 | 2.0kb | 2023-10-26 02:18:31 | 2023-10-26 02:18:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
string secret="RKRBBNNQ";
vector<string>all,all2,all3;
string temp;
string s="RQNKBb";
//string s="BbNRKQ";
int dozvoli[256],n,brpitanja;
bool uspeh;
void rek(int dubina){
if(dubina==8){
all.push_back(temp);
return;
}
for(int i=0; i<s.size(); i++){
char c=s[i];
if(dozvoli[c]!=0){
if(c=='K' and dozvoli['R']!=1)continue;
if(c=='B' and temp.size()%2==0)continue;
if(c=='b' and temp.size()%2==1)continue;
dozvoli[c]--;
temp.push_back(c);
rek(dubina+1);
temp.pop_back();
dozvoli[c]++;
}
}
}
void priprema(){
dozvoli['R']=2;
dozvoli['N']=2;
dozvoli['B']=1;
dozvoli['b']=1;
dozvoli['Q']=1;
dozvoli['K']=1;
temp.clear();
rek(0);
for(int i=0; i<all.size(); i++)
for(int j=0; j<all[i].size(); j++)
if(all[i][j]=='b')all[i][j]='B';
}
int brpoklapanja(string a,string b){
int ret=0;
for(int i=0; i<a.size(); i++)ret+=(a[i]==b[i]);
return ret;
}
int pitaj(string temp){
brpitanja++;
cout<<temp<<"\n";
int ret;
//ret=brpoklapanja(temp,secret);
cin>>ret;
return ret;
}
void prodjisatemp(string temp){
int poklapanje=pitaj(temp);
for(int i=0; i<all2.size(); i++)
if(brpoklapanja(all2[i],temp)!=poklapanje)
all2[i].clear();
for(int i=0; i<all2.size(); i++)
if(all2[i].size()>0)
all3.push_back(all2[i]);
all2=all3;
all3.clear();
if(poklapanje==8)uspeh=true;
}
int main(){
priprema();
string word;
// for(int ii=0; ii<all.size(); ii++){
// secret=all[ii];
while(cin>>word){
if(word=="END")break;
else cin>>n;
brpitanja=0;
uspeh=false;
for(int i=0; i<all.size(); i++)all2.push_back(all[i]);
while(!uspeh)prodjisatemp(all2[0]);
/*
if(brpitanja>6){
cout<<brpitanja<<" "<<secret<<endl;
//exit(3);
}
*/
}
return 0;
}
/*
NRQKBBRN
NRKQBNRB
NRKQBBRN
NRKQBBNR
NBNRBQKR
BRNNQBKR
BNRNQBKR
BBNRNQKR
BBNRKQRN
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3632kb
input:
GAME 1 1 3 5 8 END
output:
RQNNKRBB RNQKBBRN RNKBBQNR RKRBBQNN
result:
ok (c) correct after 1 tests, max moves 4 (1 test case)
Test #2:
score: 0
Accepted
time: 8ms
memory: 3920kb
input:
GAME 1 1 3 5 8 GAME 2 6 5 4 8 GAME 3 6 5 8 GAME 4 5 3 4 4 8 GAME 5 6 4 8 GAME 6 6 5 5 8 GAME 7 3 1 3 1 8 GAME 8 6 5 8 GAME 9 6 6 8 GAME 10 5 3 8 GAME 11 6 4 5 8 GAME 12 6 6 8 GAME 13 3 2 2 2 8 GAME 14 6 4 5 8 GAME 15 6 6 8 GAME 16 5 3 8 GAME 17 6 4 5 8 GAME 18 6 6 8 GAME 19 2 2 2 1 8 GAME 20 6 5 5 8...
output:
RQNNKRBB RNQKBBRN RNKBBQNR RKRBBQNN RKRBBQNN RKRQBBNN RKRNBQNB RKRBBNQN RKRBBNQN RKRNBNQB RKRBBNNQ RKRBBNNQ RQKBBNNR RKRQBBNN RKRNBNQB RKRBQNBN RKRBQNBN RKRNQNBB RKRBNQBN RKRBNQBN RKRQNBBN RKRNNQBB RKRBNNBQ RKRBNNBQ RQNKRNBB RNKBBRNQ RNBBNQKR RKRQBBNN RKRQBBNN RKRQNBBN RKRNBBQN RKRNBBQN RKRQBBNN RKR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #3:
score: 0
Accepted
time: 4ms
memory: 3580kb
input:
GAME 1 1 3 5 5 8 GAME 2 6 5 4 5 8 GAME 3 6 5 5 8 GAME 4 5 5 3 4 8 GAME 5 6 5 4 5 8 GAME 6 6 5 5 8 GAME 7 3 2 4 4 8 GAME 8 6 5 4 5 8 GAME 9 6 5 5 8 GAME 10 5 5 3 4 8 GAME 11 6 5 4 5 8 GAME 12 6 5 5 8 GAME 13 1 5 5 4 8 GAME 14 6 5 4 8 GAME 15 6 5 8 GAME 16 5 4 4 2 8 GAME 17 6 4 8 GAME 18 6 5 5 8 GAME ...
output:
RQNNKRBB RNQKBBRN RNKBBQNR RKRBBQNN RKQBBNNR RKQBBNNR RQKBBNNR RNQBBNKR RKRBBNNQ RKNBBQNR RKNBBQNR RQNBBKNR RNNBBQKR RKNBBNQR RKNBBNQR RQNBKNBR RQNBBKNR RNBBKNQR RKQBNNBR RKQBNNBR RQKBNNBR RNQBNKBR RKRBNNBQ RKNBQNBR RKNBQNBR RQNBKNBR RNNBQKBR RKNBNQBR RKNBNQBR RQNNKRBB RQKBBNNR RQBKNBNR RKQNBBNR RKQ...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #4:
score: 0
Accepted
time: 4ms
memory: 3708kb
input:
GAME 1 0 8 GAME 2 6 5 8 GAME 3 6 4 5 8 GAME 4 5 4 8 GAME 5 6 5 8 GAME 6 6 4 5 8 GAME 7 3 0 8 GAME 8 6 5 8 GAME 9 6 4 5 8 GAME 10 5 4 8 GAME 11 6 5 8 GAME 12 6 4 5 8 GAME 13 3 0 4 2 8 GAME 14 6 5 8 GAME 15 6 5 6 8 GAME 16 5 2 4 8 GAME 17 6 5 5 8 GAME 18 6 5 6 8 GAME 19 5 2 3 8 GAME 20 6 4 5 5 8 GAME ...
output:
RQNNKRBB QRKRBBNN QRKRBBNN RQKRBBNN NRKRBBQN NRKRBBQN RNKRBBQN NRKRQBBN NRKRBBNQ NRKRBBNQ RQKRBBNN QRKRBNNB QRKRBNNB RQKRBNNB NRKRBQNB NRKRBQNB RNKRBQNB NRKRNQBB NRKRBNQB NRKRBNQB RQNKBNRB QRKRNBBN QRKRNBBN RQKRNBBN NRKRQBBN NRKRQBBN RNKRQBBN NRKRQNBB NRKRNBBQ NRKRNBBQ RQKRNBBN QRKRNNBB QRKRNNBB RQK...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #5:
score: -100
Wrong Answer
time: 2ms
memory: 3620kb
input:
GAME 1 4 4 8 GAME 2 6 4 4 5 8 GAME 3 6 6 8 GAME 4 5 8 GAME 5 6 4 4 5 8 GAME 6 6 6 8 GAME 7 2 1 4 4 8 GAME 8 6 4 5 5 8 GAME 9 6 5 4 8 GAME 10 5 3 3 8 GAME 11 6 4 5 5 8 GAME 12 6 5 4 8 GAME 13 4 5 2 4 8 GAME 14 6 4 5 5 5 8 GAME 15 6 5 4 5 8 GAME 16 4 4 3 8 GAME 17 6 4 5 5 8 GAME 18 6 6 8 GAME 19 4 8 G...
output:
RQNNKRBB RQNNBBKR RQNKRBBN RQNKRBBN RQNKRNBB RQNKBBRN RQKNRBBN RNQKRBBN RNQKRBBN RQNKRBBN RNNKRBBQ RNNKRBBQ RQNKRNBB RQNKRNBB RQNKRBBN RQNKBNRB RQKNRNBB RNQKRNBB RNQKRNBB RQNKRNBB RNNKRQBB RNNKRQBB RQNNBBKR RNBBQKRN RNBBKRNQ RBBKQRNN RBBKQRNN RNBKQRNB RBQKBRNN RBNKQRBN RBBKNRQN RBBKNRQN RNBKNRQB RKB...
result:
wrong answer (i) too many guesses in game 79, pos = Q