QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#254096 | #7533. Jeopardized Betting | MikhailovBair# | WA | 1ms | 3804kb | C++17 | 1.2kb | 2023-11-18 00:29:18 | 2023-11-18 00:29:19 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
using namespace std;
string interact(int m) {
cout << m << endl;
string s;
cin >> s;
return s;
}
signed main() {
int n;
cin >> n;
map<pair<int, int>, int> result, bet;
for (int i = 0; i < n; ++i) {
result[{n, i}] = (1 << (2 * n + 1));
result[{i, n}] = 0;
}
for (int sum = (n - 1) * 2; sum >= 0; --sum) {
for (int win = min(sum, n - 1); win >= 0; --win) {
int lost = sum - win;
if (lost > n - 1) {
break;
}
result[{win, lost}] = (result[{win + 1, lost}] + result[{win, lost + 1}]) / 2;
bet[{win, lost}] = (result[{win + 1, lost}] - result[{win, lost + 1}]) / 2;
// cout << " win:" << win << " lost:" << lost << " sum:" << result[{win, lost}] << " bet:" << bet[{win, lost}];
// cout << "\n";
}
}
int total_win = 0, total_lost = 0;
while (total_win < n and total_lost < n) {
auto verdict = interact(bet[{total_win, total_lost}]);
if (verdict == "Lost") {
++total_lost;
} else {
++total_win;
}
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3804kb
input:
3 Lost Won Won Won
output:
24 24 32 32
result:
ok Ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
4 Won Lost Won Lost Won Lost Won
output:
80 80 96 96 128 128 256
result:
ok Ok
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3720kb
input:
30 Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost Lost
output:
28002324 28002324 27511055 26528517 25081507 23223618 21032711 18605859 16052114 13483775 11007164 8714004 6674556 4933368 3508173 2391936 1557540 964191 564404 310422 159191 75406 32608 12681 4347 1279 310 58 7 0
result:
wrong answer Integer 0 violates the range [1, 1152921504338411527]