QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#55712#4612. 福若格斯CharlieVinnie20 327ms50500kbC++203.6kb2022-10-14 22:48:202022-10-14 22:48:25

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-14 22:48:25]
  • 评测
  • 测评结果:20
  • 用时:327ms
  • 内存:50500kb
  • [2022-10-14 22:48:20]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std;
#define int long long
const int N=2e6+5,mod=998244353; typedef long long ll;
int qpow(int x,int y){int res=1;while(y){if(y&1){res=1ll*res*x%mod;}x=1ll*x*x%mod;y>>=1;}return res;}
int cp[N],cpinv[N];
// 0:   0
// 1:   1
// 2:   -1
// 3:   1/2
// 4:  -1/2
// 5:   ↑
// 6:   ↓
// 7:   *
int getid(string s){
    if(s=="LL_RR") return 7; // *

    if(s=="L_LRR") return 5; // ↑
    if(s=="_LLRR") return 0; // 0
    if(s=="LRL_R") return 7; // *
    if(s=="LR_LR") return 0; // 0
    if(s=="_RLLR") return 2; // -1
    if(s=="R_LLR") return 0; // 0
    if(s=="LRRL_") return 1; // 1
    if(s=="LRR_L") return 0; // 0
    if(s=="LRLR_") return 0; // 0
    if(s=="LR_RL") return 4; // -1/2
    if(s=="_RLRL") return 2; // -1
    if(s=="R_LRL") return 0; // 0
    if(s=="RRL_L") return 1; // 1
    if(s=="RR_LL") return 0; // 0

    if(s=="LLR_R") return 6; // ↓
    if(s=="LLRR_") return 0; // 0
    if(s=="L_RLR") return 7; // *
    if(s=="LR_LR") return 0; // 0
    if(s=="LRRL_") return 1; // 1
    if(s=="LRR_L") return 0; // 0
    if(s=="_RLLR") return 2; // -1
    if(s=="R_LLR") return 0; // 0
    if(s=="_LRLR") return 0; // 0
    if(s=="RL_LR") return 3; // 1/2
    if(s=="RLRL_") return 1; // 1
    if(s=="RLR_L") return 0; // 0
    if(s=="R_RLL") return 2; // -1
    if(s=="RR_LL") return 0; // 0

    throw 404;
}
int C(int x,int y) { if(y<0||x<y) return 0; else return 1ll*cp[x]*cpinv[y]%mod*cpinv[x-y]%mod; }
int sum[N*2];
void solve(){
    int n,cnt[8]={0}; cin>>n; For(i,1,n) { string s; int x; cin>>s>>x; cnt[getid(s)]+=x; }
    // For(i,0,7) cout<<cnt[i]<<' ';  cout<<endl;
    int ans[4]={0};
    For(i,-n,n) sum[i+N]=0;  For(i,-cnt[4],cnt[3]) sum[i+N]=(sum[i-1+N]+C(cnt[4]+cnt[3],cnt[4]+i))%mod;
    int zero=0; int pw0=qpow(2,cnt[5]+cnt[6]+cnt[7]);
    For(i,-cnt[2],cnt[1]){
        int u=C(cnt[2]+cnt[1],cnt[2]+i);
        ans[0]=(ans[0]+1ll*(sum[cnt[3]+N]-sum[min(cnt[3],2*(-i))+N]+mod)*pw0%mod*u)%mod;
        ans[1]=(ans[1]+1ll*sum[min(cnt[3],2*(-i)-1)+N]*pw0%mod*u)%mod;
        zero=(zero+1ll*(sum[min(cnt[3],2*(-i))+N]-sum[min(cnt[3],2*(-i)-1)+N]+mod)*u)%mod;
    }
    // cerr<<ans[0]<<' '<<ans[1]<<' '<<zero<<endl;
    For(i,-n,n) sum[i+N]=0;  For(i,-cnt[6],cnt[5]) sum[i+N]=(sum[i-1+N]+C(cnt[5]+cnt[6],cnt[6]+i))%mod;
    if(cnt[7]==0){
        ans[0]=(ans[0]+1ll*zero*(sum[cnt[5]+N]-sum[0+N]+mod))%mod;
        ans[1]=(ans[1]+1ll*zero*(sum[-1+N]+mod))%mod;
        ans[3]=(ans[3]+1ll*zero*(sum[0+N]-sum[-1+N]+mod))%mod;
    }
    else{
        int pw1=qpow(2,cnt[7]),pw2=qpow(2,cnt[7]-1);
        ans[0]=(ans[0]+1ll*zero*(sum[cnt[5]+N]-sum[min(cnt[5],1ll)+N]+mod)%mod*pw1)%mod;
        ans[1]=(ans[1]+1ll*zero*sum[-2+N]%mod*pw1)%mod;
        ans[0]=(ans[0]+1ll*zero*(sum[min(cnt[5],1ll)+N]-sum[0+N]+mod)%mod*pw2)%mod;
        ans[1]=(ans[1]+1ll*zero*(sum[-1+N]-sum[-2+N]+mod)%mod*pw2)%mod;
        ans[3]=(ans[3]+1ll*zero*(sum[min(cnt[5],1ll)+N]-sum[-2+N]+mod)%mod*pw2)%mod;
        ans[2]=(ans[2]+1ll*zero*(sum[0+N]-sum[-1+N]+mod)%mod*pw2)%mod;
    }
    For(i,0,3) ans[i]=1ll*ans[i]*qpow(2,cnt[0])%mod;
    For(i,0,3) cout<<ans[i]<<' ';  cout<<endl;
}
signed main(){
    cp[0]=1; For(i,1,N-5) cp[i]=1ll*cp[i-1]*i%mod;
    cpinv[N-5]=qpow(cp[N-5],mod-2); Rev(i,N-6,0) cpinv[i]=1ll*cpinv[i+1]*(i+1)%mod;
    int T,Charlie; cin>>Charlie>>T; while(T--) solve();
    cerr<<"Time = "<<clock()<<" ms"<<endl;
    return 0;
}

// START TYPING IF YOU DON'T KNOW WHAT TO DO

詳細信息

Test #1:

score: 5
Accepted
time: 12ms
memory: 34896kb

input:

1 100
1
LLR_R 1
1
LLR_R 1
1
LRR_L 1
1
_RLRL 1
1
RLRL_ 1
1
LRR_L 1
1
R_LLR 1
1
LRR_L 1
1
L_RLR 1
1
L_RLR 1
1
RLR_L 1
1
LR_RL 1
1
R_RLL 1
1
LRL_R 1
1
R_LLR 1
1
_RLLR 1
1
_RLLR 1
1
_RLRL 1
1
_LLRR 1
1
RLR_L 1
1
LRL_R 1
1
R_RLL 1
1
LLR_R 1
1
L_RLR 1
1
R_LLR 1
1
RL_LR 1
1
RL_LR 1
1
LLRR_ 1
1
_RLRL 1
1
L_...

output:

0 1 0 1 
0 1 0 1 
0 0 0 2 
0 1 0 1 
1 0 0 1 
0 0 0 2 
0 0 0 2 
0 0 0 2 
0 0 1 1 
0 0 1 1 
0 0 0 2 
0 1 0 1 
0 1 0 1 
0 0 1 1 
0 0 0 2 
0 1 0 1 
0 1 0 1 
0 1 0 1 
0 0 0 2 
0 0 0 2 
0 0 1 1 
0 1 0 1 
0 1 0 1 
0 0 1 1 
0 0 0 2 
1 0 0 1 
1 0 0 1 
0 0 0 2 
0 1 0 1 
0 0 1 1 
0 0 0 2 
0 1 0 1 
0 0 0 2 
0 1...

result:

ok 400 numbers

Test #2:

score: 0
Wrong Answer
time: 24ms
memory: 34884kb

input:

2 100
3
LLRR_ 1
LR_RL 1
RR_LL 1
1
_LRLR 1
4
LRR_L 1
RL_LR 1
R_LLR 1
R_LRL 1
5
LRL_R 1
LRRL_ 1
LR_LR 1
RL_LR 1
_RLRL 1
3
LLRR_ 1
LRR_L 1
RLR_L 1
2
LLR_R 1
L_LRR 1
4
LL_RR 1
LRL_R 1
R_LLR 1
_RLLR 1
4
LRRL_ 1
LR_RL 1
R_RLL 1
_RLRL 1
2
LRRL_ 1
LR_LR 1
5
LLRR_ 1
LRLR_ 1
LRRL_ 1
_RLLR 1
_RLRL 1
2
L_RLR 1
...

output:

0 4 0 4 
0 0 0 2 
8 0 0 8 
16 8 4 4 
0 0 0 8 
1 1 0 2 
0 8 4 4 
2 11 0 3 
2 0 0 2 
4 16 0 12 
0 0 2 2 
0 0 16 16 
2 0 0 2 
16 0 8 8 
20 8 0 4 
0 12 2 2 
24 0 0 8 
1 2 0 1 
0 2 0 2 
2 2 0 4 
10 2 0 4 
0 4 0 4 
13 2 0 1 
8 0 0 8 
0 4 2 2 
8 5 1 2 
4 16 4 8 
0 12 0 4 
16 4 4 8 
0 2 0 2 
0 0 0 2 
8 4 0 ...

result:

wrong answer 103rd numbers differ - expected: '2', found: '1'

Test #3:

score: 0
Wrong Answer
time: 27ms
memory: 34748kb

input:

3 100
8
LRL_R 1
LRR_L 1
LR_LR 1
LR_RL 1
RLRL_ 1
RL_LR 1
R_LLR 1
R_RLL 1
8
LL_RR 1
LRRL_ 1
LR_RL 1
RLR_L 1
RRL_L 1
R_LRL 1
_LLRR 1
_LRLR 1
8
LLRR_ 1
LLR_R 1
LL_RR 1
LRR_L 1
LR_LR 1
R_LRL 1
_LLRR 1
_LRLR 1
8
LLRR_ 1
LLR_R 1
LRL_R 1
LR_LR 1
LR_RL 1
R_LLR 1
_RLLR 1
_RLRL 1
8
LL_RR 1
LRLR_ 1
L_LRR 1
L_RL...

output:

96 96 32 32 
192 32 16 16 
0 64 64 128 
0 232 8 16 
56 128 24 48 
96 64 32 64 
40 192 8 16 
128 64 32 32 
0 224 16 16 
16 208 16 16 
128 80 24 24 
192 16 16 32 
0 224 16 16 
176 48 0 32 
128 32 32 64 
192 16 16 32 
80 80 0 96 
16 176 32 32 
128 64 32 32 
32 200 8 16 
152 32 24 48 
80 80 32 64 
128 3...

result:

wrong answer 11th numbers differ - expected: '128', found: '64'

Test #4:

score: 0
Wrong Answer
time: 23ms
memory: 34876kb

input:

4 100
10
LLR_R 1
LL_RR 1
LRL_R 1
LRRL_ 1
LRR_L 1
LR_RL 1
L_LRR 1
L_RLR 1
R_RLL 1
_RLRL 1
10
LRL_R 1
LRRL_ 1
LR_RL 1
L_LRR 1
L_RLR 1
RLRL_ 1
R_LLR 1
R_RLL 1
_LLRR 1
_RLRL 1
10
LRL_R 1
LRR_L 1
L_LRR 1
L_RLR 1
RLRL_ 1
R_LLR 1
R_LRL 1
R_RLL 1
_RLLR 1
_RLRL 1
10
LLR_R 1
LL_RR 1
LRLR_ 1
LR_RL 1
L_LRR 1
L_...

output:

152 728 48 96 
368 512 48 96 
128 704 64 128 
416 416 64 128 
320 512 64 128 
320 416 96 192 
544 288 64 128 
512 192 160 160 
128 704 64 128 
0 896 64 64 
752 128 48 96 
288 544 64 128 
368 512 48 96 
832 64 64 64 
64 576 128 256 
256 512 128 128 
560 176 96 192 
512 368 48 96 
608 320 0 96 
512 19...

result:

wrong answer 3rd numbers differ - expected: '96', found: '48'

Test #5:

score: 0
Wrong Answer
time: 131ms
memory: 50500kb

input:

5 100
1
LL_RR 838546
1
RRL_L 520881
1
LLRR_ 999980
1
RRL_L 2
1
RLRL_ 9
1
LRL_R 2
1
RL_LR 7
1
LLR_R 14
1
RLRL_ 753547
1
LRLR_ 17
1
LLR_R 722783
1
LR_LR 999985
1
LRL_R 999981
1
RLRL_ 431962
1
_LRLR 999992
1
LRRL_ 14
1
_RLLR 709382
1
RR_LL 999991
1
RL_LR 16
1
L_RLR 999992
1
LR_LR 13
1
L_RLR 999995
1
L_...

output:

0 0 50932616 50932616 
378274767 0 0 1 
0 0 0 242222522 
3 0 0 1 
511 0 0 1 
0 0 2 2 
127 0 0 1 
0 16383 0 1 
364389290 844669928 0 240437250 
0 0 0 131072 
0 462894643 0 1 
0 0 0 763410233 
0 123008607 242222522 119213915 
13686453 28124982 0 763671952 
0 0 0 886807583 
253936107 656797655 0 875269...

result:

wrong answer 33rd numbers differ - expected: '451252114', found: '364389290'

Test #6:

score: 0
Wrong Answer
time: 175ms
memory: 50356kb

input:

6 100
1
L_RLR 6
1
LR_LR 9
1
L_RLR 598544
1
_RLLR 11
1
LRR_L 999982
1
RL_LR 275578
1
L_LRR 489165
1
RRL_L 999987
1
_LLRR 15
1
RLR_L 28814
1
RR_LL 999983
1
R_RLL 999992
1
R_LRL 109447
1
LLRR_ 999987
1
LL_RR 11
1
RL_LR 999989
1
_LLRR 999985
1
LRLR_ 99274
1
RLR_L 609917
1
_LLRR 789302
1
LRL_R 1
1
_RLLR ...

output:

0 0 32 32 
0 0 0 512 
0 0 563598354 563598354 
0 2047 0 1 
0 0 0 968890088 
172890601 0 0 1 
840438312 0 0 1 
58907872 0 0 1 
0 0 0 32768 
0 0 0 569958573 
0 0 0 939535823 
0 886807582 0 1 
0 0 0 2446897 
0 0 0 58907873 
0 0 1024 1024 
235631491 0 0 1 
0 0 0 763410233 
0 0 0 380698432 
0 0 0 8426903...

result:

wrong answer 117th numbers differ - expected: '709758734', found: '909457974'

Test #7:

score: 5
Accepted
time: 18ms
memory: 34868kb

input:

7 100
1
R_LRL 500
2
RLR_L 320
R_RLL 180
2
RR_LL 261
R_LRL 239
1
RR_LL 500
3
RLR_L 278
RRL_L 199
RR_LL 23
4
RLR_L 52
RRL_L 205
RR_LL 232
R_LRL 11
1
RRL_L 500
1
RRL_L 500
2
RRL_L 276
R_RLL 224
1
R_LRL 500
3
RRL_L 23
R_LRL 154
R_RLL 323
2
RLR_L 185
R_RLL 315
3
RR_LL 141
R_LRL 42
R_RLL 317
3
RLR_L 96
RR...

output:

0 0 0 616118644 
0 997240333 0 617122664 
0 0 0 616118644 
0 0 0 616118644 
684067419 0 0 930295578 
8875191 0 0 607243453 
616118643 0 0 1 
616118643 0 0 1 
537776684 201371198 0 875215115 
0 0 0 616118644 
795839458 220997578 0 597525961 
0 99297351 0 516821293 
0 736474409 0 877888588 
0 0 0 6161...

result:

ok 400 numbers

Test #8:

score: 5
Accepted
time: 275ms
memory: 34864kb

input:

8 100
3
RLR_L 245574
RRL_L 154512
R_LRL 199914
2
RLR_L 507948
RRL_L 92052
3
RR_LL 62618
R_LRL 75910
R_RLL 461472
2
RLR_L 584457
RR_LL 15543
3
RRL_L 199727
R_LRL 267713
R_RLL 132560
4
RLR_L 93412
RRL_L 204396
RR_LL 261031
R_LRL 41161
5
RLR_L 205717
RRL_L 55856
RR_LL 37924
R_LRL 156194
R_RLL 144309
3
...

output:

589933168 0 0 64289885 
372141343 0 0 282081710 
0 200036663 0 454186390 
0 0 0 654223053 
530840957 112226214 0 11155882 
394133210 0 0 260089843 
945425698 467886576 0 239155132 
170651780 433193248 0 50378025 
804125194 0 0 848342212 
0 599201709 0 55021344 
0 0 0 654223053 
681848735 44767448 0 ...

result:

ok 400 numbers

Test #9:

score: 0
Wrong Answer
time: 38ms
memory: 34896kb

input:

9 100
16
LRLR_ 1
LRRL_ 9
LRR_L 2
LR_LR 6
LR_RL 8
RLRL_ 1
RLR_L 10
RL_LR 3
RRL_L 10
RR_LL 4
R_LLR 5
R_LRL 10
R_RLL 4
_LRLR 1
_RLLR 15
_RLRL 11
1
RR_LL 100
16
LRLR_ 7
LRRL_ 9
LRR_L 6
LR_LR 3
LR_RL 10
RLRL_ 9
RLR_L 6
RL_LR 8
RRL_L 4
RR_LL 5
R_LLR 2
R_LRL 5
R_RLL 9
_LRLR 2
_RLLR 8
_RLRL 7
6
LRR_L 15
LR_...

output:

404444034 391392352 0 86663332 
0 0 0 882499718 
131959415 927271783 0 821512873 
474227274 67875396 0 340397048 
523009412 174432988 0 185057318 
519149019 916510610 0 445084442 
78002240 460795054 0 343702424 
0 0 0 882499718 
766865590 441249859 0 672628622 
653955650 858860455 0 367927966 
12768...

result:

wrong answer 38th numbers differ - expected: '386822154', found: '858860455'

Test #10:

score: 0
Wrong Answer
time: 316ms
memory: 39636kb

input:

10 100
1
_LRLR 700000
1
RLR_L 700000
16
LRLR_ 48839
LRRL_ 44669
LRR_L 84201
LR_LR 51510
LR_RL 83993
RLRL_ 18715
RLR_L 25237
RL_LR 72656
RRL_L 29299
RR_LL 9204
R_LLR 14056
R_LRL 6221
R_RLL 19193
_LRLR 118525
_RLLR 71307
_RLRL 2375
16
LRLR_ 29471
LRRL_ 120527
LRR_L 14969
LR_LR 67351
LR_RL 66814
RLRL_ ...

output:

0 0 0 702777662 
0 0 0 702777662 
332242024 821001879 0 547778112 
830197923 879999262 0 369076126 
30513127 61913446 0 616018268 
575773749 821969784 0 303278482 
0 705279817 0 995742198 
916419189 557962008 0 62425761 
196296483 986317606 0 518407926 
0 0 0 702777662 
21156927 758526261 0 92133882...

result:

wrong answer 13th numbers differ - expected: '335337504', found: '830197923'

Test #11:

score: 5
Accepted
time: 32ms
memory: 34892kb

input:

11 100
16
LLRR_ 1
LRLR_ 1
LRR_L 1
LR_LR 1
LR_RL 1
L_RLR 1
RLRL_ 1
RLR_L 1
RRL_L 1
RR_LL 1
R_LLR 1
R_LRL 1
R_RLL 1
_LLRR 1
_RLLR 1
_RLRL 1
1
LRLR_ 16
5
LRLR_ 1
LRL_R 5
RR_LL 1
R_LLR 4
R_LRL 5
14
LLRR_ 1
LRLR_ 1
LRL_R 1
LRRL_ 1
LRR_L 1
LR_LR 1
LR_RL 1
L_RLR 1
RLRL_ 1
RL_LR 1
R_RLL 3
_LRLR 1
_RLLR 1
_R...

output:

12288 43008 5120 5120 
0 0 0 65536 
0 0 32768 32768 
6784 53376 2688 2688 
42368 14848 4160 4160 
65483 10 0 43 
0 0 0 65536 
0 0 0 65536 
0 61440 2048 2048 
32768 0 0 32768 
0 0 0 65536 
27648 27648 5120 5120 
12288 43008 5120 5120 
32 65152 176 176 
38400 16896 5120 5120 
37888 17408 5120 5120 
0 ...

result:

ok 400 numbers

Test #12:

score: 0
Wrong Answer
time: 283ms
memory: 42700kb

input:

12 100
7
LR_LR 157600
RLRL_ 17039
RLR_L 213866
RRL_L 150323
R_LLR 113530
R_RLL 112238
_RLRL 35404
2
LRL_R 75922
LRR_L 724078
2
LR_RL 690984
RL_LR 109016
9
LRLR_ 128359
LR_RL 47906
RLR_L 167269
RL_LR 51548
RR_LL 145556
R_LLR 50595
R_RLL 27503
_LLRR 51843
_RLRL 129421
20
LLRR_ 38165
LRLR_ 17214
LRL_R ...

output:

940802264 171318240 0 480349095 
0 0 297112623 297112623 
747010002 552206767 0 293252830 
324891631 183670709 0 806788805 
597106887 860228641 499703086 499703086 
918472178 721018091 974734018 974734018 
726434142 347015254 0 519020203 
49423178 298370202 123215933 123215933 
565446480 778951006 6...

result:

wrong answer 14th numbers differ - expected: '460789163', found: '183670709'

Test #13:

score: 0
Wrong Answer
time: 32ms
memory: 34808kb

input:

13 100
10
LLR_R 2
LRRL_ 3
LRR_L 1
LR_RL 1
L_LRR 1
RLRL_ 1
RR_LL 2
R_LRL 1
_LLRR 1
_LRLR 1
14
LRLR_ 1
LRL_R 1
LRRL_ 1
LRR_L 1
L_LRR 1
L_RLR 1
RLRL_ 1
RRL_L 1
RR_LL 1
R_LLR 1
R_LRL 1
R_RLL 1
_LLRR 1
_LRLR 1
7
LLR_R 2
LRLR_ 2
LR_LR 2
L_LRR 2
R_LLR 3
_LLRR 1
_RLLR 2
14
LLR_R 1
LRRL_ 1
LRR_L 1
LR_LR 1
LR...

output:

15424 768 0 192 
12288 1024 1024 2048 
1280 13568 0 1536 
9792 4672 640 1280 
10112 4352 640 1280 
4096 10240 512 1536 
8192 5888 768 1536 
2048 12032 768 1536 
13568 1280 512 1024 
0 0 0 16384 
15876 396 24 88 
0 0 8192 8192 
2048 12288 1024 1024 
0 0 0 16384 
14912 320 576 576 
2048 12800 512 1024...

result:

wrong answer 7th numbers differ - expected: '2048', found: '1024'

Test #14:

score: 0
Wrong Answer
time: 319ms
memory: 48324kb

input:

14 100
7
LRLR_ 205240
LRL_R 78053
LRR_L 117478
LR_LR 181169
L_LRR 123470
RLR_L 38145
RL_LR 156445
9
LRL_R 49578
LRRL_ 133473
LRR_L 99644
RLR_L 98826
RL_LR 78104
RR_LL 41245
R_LLR 96478
R_LRL 43326
_LLRR 259326
7
LLRR_ 226267
LRLR_ 103046
L_RLR 25019
RLRL_ 82826
RLR_L 76224
RRL_L 242226
R_LRL 144392
...

output:

815679376 0 619889036 928130740 
194353719 0 585550540 585550540 
198024949 0 583714925 583714925 
168935695 886558158 0 309960946 
407361529 460147774 869595643 436281229 
914415286 421207335 826692548 778495152 
692584243 167236716 252816920 252816920 
0 0 183605223 183605223 
0 0 0 367210446 
986...

result:

wrong answer 3rd numbers differ - expected: '928130740', found: '619889036'

Test #15:

score: 0
Wrong Answer
time: 25ms
memory: 34808kb

input:

15 100
12
LLRR_ 1
LLR_R 1
LRRL_ 1
LRR_L 1
L_LRR 1
RLRL_ 1
RRL_L 1
RR_LL 1
R_LRL 1
_LRLR 1
_RLLR 1
_RLRL 1
5
LLRR_ 4
LLR_R 1
LRL_R 1
RL_LR 3
R_LLR 3
12
LLRR_ 1
LLR_R 1
LL_RR 1
LRL_R 1
LR_LR 1
LR_RL 1
RLRL_ 1
R_LLR 1
R_RLL 1
_LLRR 1
_LRLR 1
_RLLR 1
10
LLRR_ 3
LL_RR 1
LRLR_ 1
LRL_R 1
LRRL_ 1
LR_LR 1
RL...

output:

2368 1088 0 640 
3584 128 128 256 
512 3008 192 384 
1024 1024 1024 1024 
3456 256 128 256 
2048 1472 192 384 
4064 0 0 32 
2688 448 480 480 
4032 0 32 32 
1280 2240 192 384 
0 3968 0 128 
3408 352 168 168 
704 2240 384 768 
4095 0 0 1 
4064 0 0 32 
2048 0 512 1536 
3632 134 165 165 
4095 0 0 1 
864...

result:

wrong answer 7th numbers differ - expected: '256', found: '128'

Test #16:

score: 0
Wrong Answer
time: 18ms
memory: 34924kb

input:

16 100
23
LLRR_ 306
LLR_R 264
LL_RR 252
LRLR_ 23
LRL_R 176
LRRL_ 119
LRR_L 351
LR_LR 189
LR_RL 16
L_LRR 105
L_RLR 786
RLRL_ 390
RLR_L 81
RL_LR 403
RRL_L 345
RR_LL 381
R_LLR 66
R_LRL 112
R_RLL 164
_LLRR 38
_LRLR 115
_RLLR 90
_RLRL 228
8
LLRR_ 1367
LRLR_ 327
LRL_R 47
L_RLR 571
RLR_L 1069
R_RLL 611
_LL...

output:

17680556 3304561 633576084 202402848 
0 487458002 683875200 683875200 
787427565 90524688 567153208 951189560 
895489175 436551105 0 523168122 
0 312036583 154598854 623353314 
130066533 430907846 476300816 452769601 
110955929 506188520 116713287 14605595 
0 500720912 677243745 677243745 
940562486...

result:

wrong answer 3rd numbers differ - expected: '202402848', found: '633576084'

Test #17:

score: 0
Wrong Answer
time: 56ms
memory: 36184kb

input:

17 100
18
LLRR_ 3108
LLR_R 3148
LRLR_ 2708
LRL_R 8648
LRRL_ 4617
LR_LR 8660
LR_RL 1216
L_LRR 7752
L_RLR 8022
RLRL_ 9170
RLR_L 2351
RRL_L 791
R_LLR 8061
R_LRL 2054
R_RLL 1127
_LLRR 10041
_LRLR 229
_RLRL 18297
18
LLR_R 8502
LL_RR 8872
LRLR_ 2991
LRR_L 5562
LR_LR 8388
LR_RL 2111
L_LRR 11234
RLRL_ 4073
...

output:

752224837 946662040 802140589 33722628 
48021850 142243548 38656264 482237702 
617667045 195016059 327090911 482428386 
292040797 644148641 652852587 945708069 
366243529 646620486 261820863 261820863 
730985029 747084561 528340252 528340252 
224166575 909426772 0 402912394 
102812720 404112773 5082...

result:

wrong answer 3rd numbers differ - expected: '33722628', found: '802140589'

Test #18:

score: 0
Wrong Answer
time: 88ms
memory: 37916kb

input:

18 100
23
LLRR_ 16285
LLR_R 7890
LL_RR 3986
LRLR_ 10856
LRL_R 6147
LRRL_ 9730
LRR_L 12509
LR_LR 11075
LR_RL 16759
L_LRR 1654
L_RLR 11265
RLRL_ 22225
RLR_L 4869
RL_LR 6561
RRL_L 3851
RR_LL 4129
R_LLR 10960
R_LRL 3163
R_RLL 16029
_LLRR 3332
_LRLR 2246
_RLLR 5355
_RLRL 9124
4
LL_RR 45823
LRRL_ 103101
L...

output:

722491944 372031868 968788971 102156400 
569857024 711367442 992705540 514811781 
0 792253080 0 1 
659118875 982150614 866275032 669264713 
357779956 563834006 913002505 913398447 
993866648 976705800 806053249 416145357 
514242894 175530281 159158572 156033060 
152171560 740941798 797858431 4090480...

result:

wrong answer 2nd numbers differ - expected: '995304472', found: '372031868'

Test #19:

score: 0
Wrong Answer
time: 315ms
memory: 40028kb

input:

19 100
23
LLRR_ 47450
LLR_R 33776
LL_RR 15472
LRLR_ 29835
LRL_R 19085
LRRL_ 53618
LRR_L 25656
LR_LR 38913
LR_RL 58698
L_LRR 64613
L_RLR 65782
RLRL_ 63900
RLR_L 64444
RL_LR 35115
RRL_L 82578
RR_LL 6705
R_LLR 79673
R_LRL 41936
R_RLL 10933
_LLRR 24642
_LRLR 60897
_RLLR 6400
_RLRL 69879
23
LLRR_ 49521
L...

output:

894742756 49719199 950795592 950564313 
301852547 299097117 352628771 89994412 
847508803 334585819 521167385 697635826 
816121154 181579032 740584742 599255795 
183502530 129299165 0 108471422 
462503812 677126450 313945720 964185841 
238251504 130985107 399339037 639137273 
251772085 267579418 500...

result:

wrong answer 2nd numbers differ - expected: '619903515', found: '49719199'

Test #20:

score: 0
Wrong Answer
time: 327ms
memory: 45168kb

input:

20 100
11
LLRR_ 65785
LLR_R 141603
LRLR_ 4897
LRL_R 84299
LRR_L 46271
L_RLR 144517
RL_LR 105872
RRL_L 21634
RR_LL 49891
_RLLR 141609
_RLRL 193622
15
LL_RR 118203
LRLR_ 86748
LRR_L 107291
LR_LR 43541
LR_RL 50973
L_LRR 39982
L_RLR 24845
RLRL_ 94232
RRL_L 104857
RR_LL 67123
R_LLR 74924
R_LRL 3825
R_RLL...

output:

394116507 884396595 678790237 460458484 
563730966 532759927 381814131 921753697 
458898658 636992706 829840670 168108737 
275485952 774827843 925844664 439092405 
559148480 742039464 299417218 814490718 
0 0 709758735 709758735 
778246314 5375001 162707005 850625399 
361944478 893418105 911272806 6...

result:

wrong answer 3rd numbers differ - expected: '460458484', found: '678790237'