QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#254096#7533. Jeopardized BettingMikhailovBair#WA 1ms3804kbC++171.2kb2023-11-18 00:29:182023-11-18 00:29:19

Judging History

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

  • [2023-11-18 00:29:19]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3804kb
  • [2023-11-18 00:29:18]
  • 提交

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]