QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#263433#7533. Jeopardized BettingMikhail#WA 1ms3608kbC++171.3kb2023-11-24 20:40:372023-11-24 20:40:37

Judging History

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

  • [2023-11-24 20:40:37]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2023-11-24 20:40:37]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define cheat ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define cyes cout<<"Yes"<<endl
#define cno cout<<"No"<<endl
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fe first
#define se second
#define int long long


using namespace std;


const ll inf = 1e18;

bool bet(long long x){
    static string s;
    cout << x << endl;

    cin >> s;
    if (s[0]=='W'){
        return 1;
    }
    else{
        return 0;
    }
}



signed main(){
    long long n;
    cin >> n;
    vector<vector<long long>> dp(n+1,vector<long long>(n+1,-1));
    long long start=(1<<(2*n));
    long long win_end=start*2;
    long long lose_end=0;
    for(int i=0;i<n;++i){
        dp[n][i]=win_end;
    }
    for(int i=0;i<n;++i){
        dp[i][n]=lose_end;
    }

    for(int i=0;i<n;++i){
        for(int j=0;j<n;++j){
            int indi=n-1-i;
            int indj=n-1-j;
            dp[indi][indj]=(dp[indi+1][indj]+dp[indi][indj+1])/2;
        }
    }

    int wins=0;
    int loses=0;
    while(wins<n && loses<n){
        long long amount=dp[wins+1][loses]-dp[wins][loses];
        if (bet(amount)){
            ++wins;
        }
        else{
            ++loses;
        }
    }

}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3604kb

input:

3
Lost
Won
Won
Won

output:

24
24
32
32

result:

ok Ok

Test #2:

score: 0
Accepted
time: 1ms
memory: 3608kb

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: 3488kb

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
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won
Won

output:

28002325
28002325
27511056
26528518
25081508
23223618
21032711
18605860
16052114
13483776
11007164
8714005
6674557
4933368
3508173
2391936
1557540
964192
564405
310423
159191
75406
32608
12681
4348
1279
311
59
8
1
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
131072
262144
52428...

result:

wrong answer Expected: 2305843009213693952, has: 1152921504875282423