QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#167712 | #7179. Fischer's Chess Guessing Game | ucup-team1134# | AC ✓ | 681ms | 3908kb | C++17 | 2.6kb | 2023-09-07 16:48:37 | 2023-09-07 16:48:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;
string sam="RKRBBQNN";
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string U="KQRRBBNN";
sort(all(U));
vector<string> X;
do{
bool ok=true;
vector<int> R,B;
int K=-1;
for(int i=0;i<si(U);i++){
if(U[i]=='R') R.push_back(i);
if(U[i]=='B') B.push_back(i);
if(U[i]=='K') K=i;
}
ok&=(R[0]<K&&K<R[1]);
ok&=((B[1]-B[0])&1);
if(ok){
X.push_back(U);
}
}while(next_permutation(all(U)));
while(1){
string inp;cin>>inp;
if(inp=="END") return 0;
int zzz;cin>>zzz;
bool done=false;
vector<string> rem=X;
for(int q=0;q<5;q++){
pair<int,int> mi=mp(INF,INF);
for(int i=0;i<si(X);i++){
vector<int> rec(9);
for(int j=0;j<si(rem);j++){
int cn=0;
for(int k=0;k<si(U);k++){
if(X[i][k]==rem[j][k]) cn++;
}
rec[cn]++;
}
int ma=-1;
for(int j=0;j<9;j++) chmax(ma,rec[j]);
chmin(mi,mp(ma,i));
}
int i=mi.se;
cout<<X[i]<<endl;
int cnc=0;cin>>cnc;
if(cnc==8){
done=true;
break;
}
//cout<<cnc<<endl;
vector<string> nex;
for(int j=0;j<si(rem);j++){
int cn=0;
for(int k=0;k<si(U);k++){
if(X[i][k]==rem[j][k]) cn++;
}
//cout<<rem[j]<<" "<<cn<<endl;
if(cn==cnc) nex.push_back(rem[j]);
}
rem=nex;
//for(auto aa:rem) cout<<aa<<endl;
//cout<<endl;
}
if(!done){
cout<<rem[0]<<endl;
int z;cin>>z;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 9ms
memory: 3708kb
input:
GAME 1 1 0 2 4 0 8 END
output:
NRBBNKQR BRNNKBQR NBRKNQBR QBRKBRNN BBNNQRKR RKRBBQNN
result:
ok (c) correct after 1 tests, max moves 6 (1 test case)
Test #2:
score: 0
Accepted
time: 668ms
memory: 3620kb
input:
GAME 1 1 0 2 4 0 8 GAME 2 2 3 3 1 1 8 GAME 3 1 0 1 2 0 8 GAME 4 1 0 2 2 1 8 GAME 5 2 3 4 2 0 8 GAME 6 2 2 4 0 0 8 GAME 7 0 2 3 2 0 8 GAME 8 1 3 3 0 1 8 GAME 9 0 3 3 0 1 8 GAME 10 0 3 3 1 0 8 GAME 11 0 5 1 0 1 8 GAME 12 1 2 2 1 0 8 GAME 13 1 1 5 1 0 8 GAME 14 0 4 4 3 2 8 GAME 15 1 2 1 2 1 8 GAME 16 1...
output:
NRBBNKQR BRNNKBQR NBRKNQBR QBRKBRNN BBNNQRKR RKRBBQNN NRBBNKQR RNBBQKRN RQKBNNBR BBRNNQKR BBNNRKQR RKRBBNQN NRBBNKQR BRNNKBQR NBRKNQBR BNRKQRNB BBNNQRKR RKRBBNNQ NRBBNKQR BRNNKBQR NBRKNQBR QBRKBRNN BBNNQRKR RKRBQNBN NRBBNKQR RNBBQKRN RQKBNNBR QNRBBKNR BBNNQRKR RKRBNQBN NRBBNKQR RNBBQKRN QNRBKNBR BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #3:
score: 0
Accepted
time: 668ms
memory: 3640kb
input:
GAME 1 2 2 3 1 2 8 GAME 2 2 2 2 5 2 8 GAME 3 3 1 4 2 2 8 GAME 4 3 1 3 1 1 8 GAME 5 2 3 5 2 3 8 GAME 6 3 1 3 0 2 8 GAME 7 1 3 5 1 2 8 GAME 8 1 3 3 4 2 8 GAME 9 2 1 3 2 3 8 GAME 10 2 1 0 0 4 8 GAME 11 2 1 1 3 2 8 GAME 12 1 4 3 4 4 8 GAME 13 0 2 2 3 1 8 GAME 14 1 1 2 2 2 8 GAME 15 0 1 0 1 1 8 GAME 16 0...
output:
NRBBNKQR RNBBQKRN QNRBKNBR BNNQRBKR BBQNNRKR RKQBBNNR NRBBNKQR RNBBQKRN QNRBKNBR RBNNBQKR BBNNQRKR RKNBBQNR NRBBNKQR RBBNQKRN BQNBRNKR BRKRNNQB BBNNQRKR RKNBBNQR NRBBNKQR RBBNQKRN BQNBRNKR BBRNKNRQ BBNNRKQR RKQBNNBR NRBBNKQR RNBBQKRN RQKBNNBR BBNNRKQR BBNNQRKR RKNBQNBR NRBBNKQR RBBNQKRN BQNBRNKR BBR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #4:
score: 0
Accepted
time: 681ms
memory: 3900kb
input:
GAME 1 1 2 1 4 0 8 GAME 2 3 1 0 1 0 8 GAME 3 2 0 3 0 0 8 GAME 4 1 1 0 1 0 8 GAME 5 2 0 4 0 0 8 GAME 6 3 0 1 0 0 8 GAME 7 2 1 1 0 0 8 GAME 8 2 2 1 1 0 8 GAME 9 3 0 0 6 0 8 GAME 10 2 0 4 1 0 8 GAME 11 2 1 3 1 1 8 GAME 12 3 0 0 4 0 8 GAME 13 2 2 1 1 2 8 GAME 14 3 1 4 5 1 8 GAME 15 2 1 1 3 1 8 GAME 16 1...
output:
NRBBNKQR BRNNKBQR BNRBKRQN BRKQNBNR BBNNQRKR QRKRBBNN NRBBNKQR RBBNQKRN BQNBRNKR BNQRKRNB BBNNQRKR NRKRBBQN NRBBNKQR RNBBQKRN BRKQNRNB BBQNNRKR BBNNQRKR NRKRBBNQ NRBBNKQR BRNNKBQR RKQNRBBN BBRKNNRQ BBNNQRKR QRKRBNNB NRBBNKQR RNBBQKRN BRKQNRNB BBNQRNKR BBNNQRKR NRKRBQNB NRBBNKQR RBBNQKRN BNRBQNKR BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #5:
score: 0
Accepted
time: 674ms
memory: 3644kb
input:
GAME 1 0 4 5 2 1 8 GAME 2 0 3 0 2 0 8 GAME 3 0 4 5 3 1 8 GAME 4 0 5 1 3 1 8 GAME 5 0 4 4 2 0 8 GAME 6 0 6 4 1 1 8 GAME 7 1 0 2 5 3 8 GAME 8 3 4 1 3 2 8 GAME 9 2 2 0 0 2 8 GAME 10 0 1 0 2 2 8 GAME 11 1 2 3 1 3 8 GAME 12 0 2 4 0 3 8 GAME 13 1 0 4 2 1 8 GAME 14 0 3 1 1 4 8 GAME 15 1 1 2 1 3 8 GAME 16 2...
output:
NRBBNKQR RKNNRQBB QNRKRBBN BBNNRKRQ BBNNQRKR RQNKRBBN NRBBNKQR RKNNRQBB BQRNKRNB NRKQRNBB BBNNQRKR RNQKRBBN NRBBNKQR RKNNRQBB QNRKRBBN BBNNRKRQ BBNNQRKR RNNKRBBQ NRBBNKQR RKNNRQBB BBNRKQRN BBNQRNKR BBNNQRKR RQNKRNBB NRBBNKQR RKNNRQBB QNRKRBBN BBRKQNRN BBNNQRKR RNQKRNBB NRBBNKQR RKNNRQBB BNNRKQRB BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #6:
score: 0
Accepted
time: 661ms
memory: 3876kb
input:
GAME 1 3 3 1 2 0 8 GAME 2 3 4 0 0 1 8 GAME 3 4 3 1 0 0 8 GAME 4 3 2 0 3 0 8 GAME 5 3 3 0 2 1 8 GAME 6 4 2 0 1 0 8 GAME 7 1 3 1 1 1 8 GAME 8 2 2 0 4 0 8 GAME 9 2 1 5 1 1 8 GAME 10 1 2 0 2 1 8 GAME 11 2 1 5 0 0 8 GAME 12 2 1 6 2 1 8 GAME 13 3 0 2 3 2 8 GAME 14 2 1 3 5 4 8 GAME 15 4 2 4 4 3 8 GAME 16 4...
output:
NRBBNKQR RBBNQKRN BBQRNKNR BBNRQKRN BBNNRKQR QRBKNBRN NRBBNKQR RBBNQKRN BBNNRQKR BBNQRKNR BBNNQRKR NRBKQBRN NRBBNKQR BNRBNKRQ BNNRQBKR BNRBQKNR BBNNQRKR NRBKNBRQ NRBBNKQR RBBNQKRN BBNQRKNR BQRKNRNB BBNNQRKR QRBKNNRB NRBBNKQR RBBNQKRN BBQRNKNR BBRNKNRQ BBNNQRKR NRBKQNRB NRBBNKQR BNRBNKRQ BBNNRKQR BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #7:
score: 0
Accepted
time: 669ms
memory: 3728kb
input:
GAME 1 1 1 2 2 1 8 GAME 2 2 3 1 1 3 8 GAME 3 1 2 2 3 2 8 GAME 4 0 3 3 3 3 8 GAME 5 0 3 2 1 3 8 GAME 6 0 4 1 4 4 8 GAME 7 2 4 2 0 1 8 GAME 8 3 3 0 1 1 8 GAME 9 2 4 3 2 1 8 GAME 10 1 2 2 1 1 8 GAME 11 1 1 1 8 GAME 12 2 3 1 0 2 8 GAME 13 1 2 4 3 2 8 GAME 14 1 1 4 1 1 8 GAME 15 1 2 4 4 2 8 GAME 16 0 5 2...
output:
NRBBNKQR BRNNKBQR RKQNRBBN BBRNQKRN BBNNRKQR RBBQKRNN NRBBNKQR RNBBQKRN RQKBNNBR BBNRNKRQ BBNNQRKR RBBNKRQN NRBBNKQR BRNNKBQR BNRBKRQN BBNNRKRQ BBNQNRKR RBBNKRNQ NRBBNKQR RKNNRQBB BQRNKRNB NQNRKRBB BBNNQRKR RBQNKRBN NRBBNKQR RKNNRQBB BQRNKRNB QRNKBNRB BBNNQRKR RBNQKRBN NRBBNKQR RKNNRQBB QNRKRBBN BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #8:
score: 0
Accepted
time: 670ms
memory: 3644kb
input:
GAME 1 3 0 3 3 2 8 GAME 2 4 1 2 2 1 8 GAME 3 4 1 2 4 2 8 GAME 4 2 0 1 2 3 8 GAME 5 3 1 1 2 2 8 GAME 6 3 0 1 3 3 8 GAME 7 0 0 6 3 3 8 GAME 8 1 4 1 5 4 8 GAME 9 0 1 4 4 4 8 GAME 10 1 2 6 2 2 8 GAME 11 2 3 1 1 2 8 GAME 12 1 2 6 1 2 8 GAME 13 0 2 0 3 3 8 GAME 14 0 1 5 2 2 8 GAME 15 1 4 2 3 3 8 GAME 16 0...
output:
NRBBNKQR RBBNQKRN BNRBQNKR BQNBNRKR BBNNQRKR QRNBKNBR NRBBNKQR BNRBNKRQ NQBRNBKR BBNRKQNR BBNNQRKR NRQBKNBR NRBBNKQR BNRBNKRQ NQBRNBKR BBNRKQNR BBNNQRKR NRNBKQBR NRBBNKQR RNBBQKRN BRKQNRNB BBRQKNNR BBNNQRKR QRNNKBBR NRBBNKQR RBBNQKRN BQNBRNKR BBRNNQKR BBNNQRKR NRQNKBBR NRBBNKQR RBBNQKRN BNRBQNKR BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #9:
score: 0
Accepted
time: 637ms
memory: 3668kb
input:
GAME 1 2 1 0 3 2 8 GAME 2 3 2 3 2 2 8 GAME 3 4 0 1 3 2 8 GAME 4 1 3 3 3 3 8 GAME 5 2 0 0 2 2 8 GAME 6 2 0 0 2 3 8 GAME 7 2 2 4 1 1 8 GAME 8 3 1 2 3 1 8 GAME 9 4 1 5 1 1 8 GAME 10 1 4 4 2 2 8 GAME 11 2 0 0 4 2 8 GAME 12 2 1 1 1 2 8 GAME 13 3 6 1 2 1 8 GAME 14 2 6 3 3 3 8 GAME 15 3 6 2 3 2 8 GAME 16 1...
output:
NRBBNKQR RNBBQKRN NRNKBRQB BBRKRNNQ BBNNQRKR QBBRKNNR NRBBNKQR RBBNQKRN BBNQRKNR BBNRQKRN BBNNQRKR NBBRKQNR NRBBNKQR BNRBNKRQ BRNKQBNR BBNNRKQR BBNNQRKR NBBRKNQR NRBBNKQR BRNNKBQR RBQNBNKR BBNQRKNR BBNNQRKR QBNRKNBR NRBBNKQR RNBBQKRN BRKQNRNB BQRNKBNR BBNNQRKR NBQRKNBR NRBBNKQR RNBBQKRN BRKQNRNB BQR...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #10:
score: 0
Accepted
time: 629ms
memory: 3900kb
input:
GAME 1 3 2 6 4 3 8 GAME 2 2 2 2 3 5 8 GAME 3 4 4 2 4 4 8 GAME 4 4 5 2 2 2 8 GAME 5 3 2 4 4 3 8 GAME 6 5 5 2 2 2 8 GAME 7 2 1 1 4 3 8 GAME 8 3 2 5 2 2 8 GAME 9 4 2 5 3 3 8 GAME 10 3 3 4 3 3 8 GAME 11 4 3 1 3 2 8 GAME 12 3 4 3 2 4 8 GAME 13 3 1 2 2 2 8 GAME 14 4 3 1 5 1 8 GAME 15 5 3 2 1 1 8 GAME 16 4...
output:
NRBBNKQR RBBNQKRN BBNQRKNR BBNNRKQR BBNNQRKR BBRQNKNR NRBBNKQR RNBBQKRN QNRBKNBR RBNNBQKR BBNNQRKR BBRNQKNR NRBBNKQR BNRBNKRQ BBNRKNRQ BBNNQRKR BBNNQRKR BBRNNKQR NRBBNKQR BNRBNKRQ BBNNRKRQ BBNNQRKR BBNNQRKR BQRBNKNR NRBBNKQR RBBNQKRN BBNQRKNR BRNBQKRN BBNNQRKR BNRBQKNR NRBBNKQR BQRBNNKR NQBBRNKR BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Test #11:
score: 0
Accepted
time: 658ms
memory: 3908kb
input:
GAME 1 2 2 3 3 3 8 GAME 2 2 3 4 4 2 8 GAME 3 2 3 3 3 3 8 GAME 4 1 4 4 3 4 8 GAME 5 1 3 6 2 3 8 GAME 6 1 3 4 4 2 8 GAME 7 4 3 3 6 3 8 GAME 8 3 1 6 5 5 8 GAME 9 4 3 4 3 4 8 GAME 10 3 1 3 2 4 8 GAME 11 3 0 3 5 4 8 GAME 12 2 1 2 5 6 8 GAME 13 5 5 5 2 2 8 GAME 14 5 4 0 3 3 8 GAME 15 6 1 1 2 2 8 GAME 16 4...
output:
NRBBNKQR RNBBQKRN QNRBKNBR BNNQRBKR BBNNQRKR RQNBBNKR NRBBNKQR RNBBQKRN RQKBNNBR QNRBBKNR BBNNQRKR RNQBBNKR NRBBNKQR RNBBQKRN RQKBNNBR BBRNNQKR BBNNQRKR RNNBBQKR NRBBNKQR BRNNKBQR QNBNRBKR BBNQNRKR BBNNQRKR RQNNBBKR NRBBNKQR BRNNKBQR RBQNBNKR BBNNRKQR BBNNQRKR RNQNBBKR NRBBNKQR BRNNKBQR RBQNBNKR BBN...
result:
ok (c) correct after 96 tests, max moves 6 (96 test cases)
Extra Test:
score: 0
Extra Test Passed