QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#226479 | #7179. Fischer's Chess Guessing Game | acagubica | WA | 1ms | 3620kb | C++14 | 1.9kb | 2023-10-25 23:41:14 | 2023-10-25 23:41:14 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
string secret="RNKQNBBR";
vector<string>all,all2,all3;
string temp,s="RNBbQK";
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;
all2.push_back("RNNBBQKR");
all2.push_back("NRBNQKRB");
all2.push_back("BBRQKRNN");
for(int i=0; i<all.size(); i++)all2.push_back(all[i]);
while(!uspeh)prodjisatemp(all2[0]);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3620kb
input:
GAME 1 4 2 1 4 8 END
output:
RNNBBQKR RNNBKRBQ RNBNQBKR RBNKBQRN RKRBBQNN
result:
ok (c) correct after 1 tests, max moves 5 (1 test case)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3536kb
input:
GAME 1 4 2 1 4 8 GAME 2 6 4 5 8 GAME 3 6 5 8 GAME 4 5 2 4 8 GAME 5 6 4 8 GAME 6 6 5 8 GAME 7 3 2 1 6 8 GAME 8 6 6 8 GAME 9 6 5 8 GAME 10 5 3 5 8 GAME 11 6 6 8 GAME 12 6 5 8 GAME 13 3 1 1 8 GAME 14 6 6 8 GAME 15 6 8 GAME 16 5 3 5 8 GAME 17 6 6 8 GAME 18 6 8 GAME 19 2 1 4 3 8 GAME 20 6 5 8 GAME 21 6 4...
output:
RNNBBQKR RNNBKRBQ RNBNQBKR RBNKBQRN RKRBBQNN RKRBBQNN RKRNBQNB RKRBNQBN RKRBBNQN RKRBBNQN RKRNBNQB RKRBBNNQ RKRBBNNQ RNKBBRNQ RKRNBNQB RKRBQNBN RKRBQNBN RKRNQNBB RKRBNQBN RKRBNQBN RKRNNQBB RKRBNNBQ RKRBNNBQ RNNBBKRQ RNQKRNBB RKRNBBQN RKRQBBNN RKRQBBNN RKRNBBNQ RKRNBBQN RKRNBBQN RKRNBNQB RKRNBBNQ RKR...
result:
wrong answer (i) too many guesses in game 37, pos = \x10E<