QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#225179#7179. Fischer's Chess Guessing GameacagubicaWA 1ms3720kbC++141.7kb2023-10-24 03:13:422023-10-24 03:13:42

Judging History

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

  • [2023-10-24 03:13:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3720kb
  • [2023-10-24 03:13:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
string secret="QRBBNKRN";
vector<string>all,all2,all3;
string temp,s="RNBbQK";
int dozvoli[256],n;
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){
  if(a.size()!=b.size()){
    cout<<temp<<" "<<b<<endl;
    exit(2);
  }
  int ret=0;
  for(int i=0; i<a.size(); i++)ret+=(a[i]==b[i]);
  return ret;
}
int pitaj(string temp){
  cout<<temp<<"\n";
  int ret;
  //ret=brpoklapanja(temp,secret);
  cin>>ret;
  return ret;
}
int main(){
  priprema();
  string word;
  while(cin>>word){
    all2=all;
    if(word=="END")break;
    else cin>>n;
    while(true){
      string temp=all2[0];
      int poklapanje=pitaj(temp);
      if(poklapanje==8)break;
      for(int i=1; i<all2.size(); i++)
        if(brpoklapanja(all2[i],temp)!=poklapanje)
          all2[i].clear();
      for(int i=1; i<all2.size(); i++)
        if(all2[i].size()>0)
          all3.push_back(all2[i]);
      all2=all3;
      all3.clear();
    }
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3720kb

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: 3672kb

input:

GAME 1
4
2
1
4
8
GAME 2
3
1
2
3
6
8
GAME 3
3
1
2
3
8
GAME 4
2
2
3
3
8
GAME 5
3
2
3
1
8
GAME 6
2
1
2
3
8
GAME 7
2
1
3
1
8
GAME 8
2
2
3
2
1
8
GAME 9
2
2
2
3
2
8
GAME 10
2
2
1
4
8
GAME 11
3
2
1
3
8
GAME 12
2
3
1
2
8
GAME 13
1
2
3
3
8
GAME 14
1
2
3
2
8
GAME 15
1
4
2
4
8
GAME 16
1
2
3
5
8
GAME 17
1
2
3
4...

output:

RNNBBQKR
RNNBKRBQ
RNBNQBKR
RBNKBQRN
RKRBBQNN
RNNBBQKR
RNNQKRBB
RBBNQNKR
RBKRBQNN
RKRBBNNQ
RKRBBNQN
RNNBBQKR
RNNQKRBB
RBBNQNKR
RBKRBQNN
RKRBBNNQ
RNNBBQKR
RNBNQKRB
RNQKRBBN
RBQNKNBR
RKRBQNBN
RNNBBQKR
RNNQKRBB
RNBBNKRQ
RNBKQBNR
RKRBNQBN
RNNBBQKR
RNBNQKRB
RBNQKRBN
RBKRBNNQ
RKRBNNBQ
RNNBBQKR
RNBNQKRB
RBN...

result:

wrong answer (i) too many guesses in game 23, pos = 0S