QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#491748 | #7179. Fischer's Chess Guessing Game | no_RED_no_DEAD | WA | 2ms | 3972kb | C++20 | 2.1kb | 2024-07-25 21:45:36 | 2024-07-25 21:45:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 1e6 + 1;
const ll M = 1e9 + 7;
vector<string> v, res;
string S[] = {"NRBBNQKR", "RKBBNQRN", "BBNNQRKR", "BBRKNNRQ", ""};
ll val[N];
ll cal(string &s, string &t) {
ll res = 0;
for (int i = 0; i <= 7; i ++)
if (s[i] == t[i]) res ++;
return res;
}
void doTest(ll testID) {
for (int _ = 1; _ <= 100; _ ++) {
cout << "GAME " << _ << endl;
for (int i = 0; i < 4; i ++) {
cout << S[i] << endl;
cin >> val[i];
}
res.clear();
for (auto x: v) {
bool ok = 1;
for (int i = 0; i < 4; i ++)
if (cal(x, S[i]) != val[i]) {ok = 0; break;}
if (ok) res.push_back(x);
}
for (auto x: v) {
set<ll> s;
for (auto y: res) s.insert(cal(x, y));
if (s.size() == res.size()) {
S[4] = x;
cout << S[4] << endl;
cin >> val[4];
break;
}
}
for (auto x: v) {
bool ok = 1;
for (int i = 0; i < 5; i ++)
if (cal(x, S[i]) != val[i]) {ok = 0; break;}
if (ok) {
cout << x << endl;
break;
}
}
cout << "END" << endl;
}
}
signed main() {
set<string> s;
string T = "KNNBBRRQ";
sort(T.begin(), T.end());
do {
vector<ll> b, r, k;
for (int i = 0; i <= 7; i ++) if (T[i] == 'B') b.push_back(i);
for (int i = 0; i <= 7; i ++) if (T[i] == 'K') k.push_back(i);
for (int i = 0; i <= 7; i ++) if (T[i] == 'R') r.push_back(i);
if ((b[1] - b[0]) % 2 == 0) continue;
if (r[0] > k[0] || r[1] < k[0]) continue;
s.insert(T);
} while(next_permutation(T.begin(), T.end()));
for (auto x: s) v.push_back(x);
ios_base::sync_with_stdio(0); cin.tie(0);
int test = 1;
// cin >> test;
for (int _ = 1; _ <= test; _ ++) doTest(test);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3972kb
input:
GAME 1
output:
GAME 1 NRBBNQKR RKBBNQRN BBNNQRKR BBRKNNRQ BBNNQRKR END GAME 2 NRBBNQKR RKBBNQRN BBNNQRKR BBRKNNRQ BBNNQRKR END GAME 3 NRBBNQKR RKBBNQRN BBNNQRKR BBRKNNRQ BBNNQRKR END GAME 4 NRBBNQKR RKBBNQRN BBNNQRKR BBRKNNRQ BBNNQRKR END GAME 5 NRBBNQKR RKBBNQRN BBNNQRKR BBRKNNRQ BBNNQRKR END GAME 6 NRBBNQKR RKBB...
result:
wrong answer (i) illegal position "GAME 1" (game 1, guess 1) (test case 1)