QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#226479#7179. Fischer's Chess Guessing GameacagubicaWA 1ms3620kbC++141.9kb2023-10-25 23:41:142023-10-25 23:41:14

Judging History

你现在查看的是最新测评结果

  • [2023-10-25 23:41:14]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3620kb
  • [2023-10-25 23:41:14]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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<