QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#468851 | #7179. Fischer's Chess Guessing Game | embusca# | TL | 0ms | 0kb | C++20 | 1.3kb | 2024-07-09 01:58:57 | 2024-07-09 01:58:58 |
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rp(i,a,b) for(int i=a;i<b;i++)
vector<string> resp;
bool veri(string &t){
int te = -1;
rp(i, 0, 8){
if(te > 0 && t[i] == 'B' && (i%2) == (te%2)) return false;
else if(t[i] == 'B') te = i;
}
rp(i, 0, 8){
if(t[i] == 'K'){
bool flag1 = true, flag2 = true;
rp(j, 0, i) if(t[j] == 'R') flag1 = false;
rp(j, i, 8) if(t[j] == 'R') flag2 = false;
if(flag1 || flag2) return false;
break;
}
}
return true;
}
void solvetask(){
int n;
cin >> n;
string comp = "RKRBBQNN";
for(auto at: resp){
cout << at << endl;
fflush (stdout);
int t=0;
cin >> t;
//rp(i, 0, 8) if(comp[i] == at[i]) t++;
if(t == 8) return;
}
}
void pre_cal(){
string temp = "KQRRBBNN";
sort(temp.begin(), temp.end());
while(next_permutation(temp.begin(), temp.end())){
if(veri(temp))resp.push_back(temp);
else continue;
}
}
int main(){
cin.tie(0)->sync_with_stdio(0);
string t;
pre_cal();
while(true){
cin >> t;
if(t == "END") return 0;
solvetask();
}
}
詳細信息
Test #1:
score: 0
Time Limit Exceeded
input:
GAME 1 0 0 0 1 0 1
output:
BBNNQRKR BBNNRKQR BBNNRKRQ BBNNRQKR BBNQNRKR BBNQRKNR BBNQRKRN