QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#140291 | #4612. 福若格斯 | myee | 100 ✓ | 93ms | 26812kb | C++11 | 6.0kb | 2023-08-15 17:00:06 | 2023-08-15 17:00:08 |
Judging History
answer
// 那就是希望。
// 即便需要取模,也是光明。
#include <algorithm>
#include <stdio.h>
#include <vector>
typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
T ans=1%mod;
while(index)
{
if(index&1)ans=ans*base%mod;
base=base*base%mod,index>>=1;
}
return ans;
}
namespace ConstMod
{
template<const ullt p>
class mod_ullt
{
private:
ullt v;
inline ullt chg(ullt w){return(w<p)?w:w-p;}
inline mod_ullt _chg(ullt w){mod_ullt ans;ans.v=(w<p)?w:w-p;return ans;}
public:
mod_ullt():v(0){}
mod_ullt(ullt v):v(v%p){}
bol empty(){return!v;}
inline ullt val(){return v;}
friend bol operator<(mod_ullt a,mod_ullt b){return a.v<b.v;}
friend bol operator>(mod_ullt a,mod_ullt b){return a.v>b.v;}
friend bol operator<=(mod_ullt a,mod_ullt b){return a.v<=b.v;}
friend bol operator>=(mod_ullt a,mod_ullt b){return a.v>=b.v;}
friend bol operator==(mod_ullt a,mod_ullt b){return a.v==b.v;}
friend bol operator!=(mod_ullt a,mod_ullt b){return a.v!=b.v;}
inline friend mod_ullt operator+(mod_ullt a,mod_ullt b){return a._chg(a.v+b.v);}
inline friend mod_ullt operator-(mod_ullt a,mod_ullt b){return a._chg(a.v+a.chg(p-b.v));}
inline friend mod_ullt operator*(mod_ullt a,mod_ullt b){return a.v*b.v;}
friend mod_ullt operator/(mod_ullt a,mod_ullt b){return b._power(p-2)*a.v;}
friend mod_ullt operator^(mod_ullt a,ullt b){return a._power(b);}
inline mod_ullt operator-(){return _chg(p-v);}
mod_ullt sqrt()
{
if(power(v,(p-1)>>1,p)!=1)return 0;
mod_ullt b=1;do b++;while(b._power((p-1)>>1)==1);
ullt t=p-1,s=0,k=1;while(!(t&1))s++,t>>=1;
mod_ullt x=_power((t+1)>>1),e=_power(t);
while(k<s)
{
if(e._power(1llu<<(s-k-1))!=1)x*=b._power((1llu<<(k-1))*t);
e=_power(p-2)*x*x,k++;
}
return _min(x,-x),x;
}
mod_ullt inv(){return _power(p-2);}
mod_ullt _power(ullt index){mod_ullt ans(1),w(v);while(index){if(index&1)ans*=w;w*=w,index>>=1;}return ans;}
voi read(){v=0;chr c;do c=getchar();while(c>'9'||c<'0');do v=(c-'0'+v*10)%p,c=getchar();while(c>='0'&&c<='9');v%=p;}
voi print()
{
static chr C[20];uint tp=0;
ullt w=v;do C[tp++]=w%10+'0',w/=10;while(w);
while(tp--)putchar(C[tp]);
}
voi println(){print(),putchar('\n');}
mod_ullt operator++(int){mod_ullt ans=*this;return v=chg(v+1),ans;}
public:
inline ullt&operator()(){return v;}
inline mod_ullt&operator+=(mod_ullt b){return*this=_chg(v+b.v);}
inline mod_ullt&operator-=(mod_ullt b){return*this=_chg(v+chg(p-b.v));}
inline mod_ullt&operator*=(mod_ullt b){return*this=v*b.v;}
mod_ullt&operator^=(ullt b){return*this=_power(b);}
mod_ullt&operator/=(mod_ullt b){return*this=b._power(p-2)*v;}
mod_ullt&operator++(){return v=chg(v+1),*this;}
};
}
// Heaven and Earth... My guiding star...
// Akira Complex R.I.P.
const ullt Mod=998244353;
typedef ConstMod::mod_ullt<Mod>modint;
typedef std::vector<modint>modvec;
modint P[1000005],Q[1000005];
uint A[100001];
voi solve()
{
static uint Cnt[9];for(auto&s:Cnt)s=0;
uint q;scanf("%u",&q);
while(q--)
{
static chr C[7];uint c,p=0;scanf("%s%u",C,&c);
for(uint i=0;i<5;i++)p=p*10+(C[i]!='_'?C[i]=='R'?3:2:1);
Cnt[A[p]]+=c;
}
modint ansA,ansB,ansF,ansS,g;
{
static modint X[1000005];
uint a=Cnt[1]+Cnt[2],b=Cnt[3]+Cnt[4],d=Cnt[2]+Cnt[4]*2;modint x;
for(uint i=0;i<=a;i++)X[i]=Q[i]*Q[a-i];
for(uint i=a<d?(d-a+1)/2:0;i<=b&&i*2<=d;i++)g+=X[d-i*2]*Q[i]*Q[b-i];
for(uint i=1;i<=a;i++)X[i]+=X[i-1];
for(uint i=0;i<=b&&i*2<=d;i++)x+=X[std::min(d-i*2,a)]*Q[i]*Q[b-i];
modint w=modint(2)^(Cnt[5]+Cnt[6]+Cnt[7]);
x*=P[a]*P[b],g*=P[a]*P[b],ansA=w*((modint(2)^(a+b))-x),ansB=w*(x-g);
}
{
uint a=Cnt[6]+Cnt[7],d=Cnt[7];modint x,y,z,w,v;
for(uint i=0;i<=a;i++)(i<=d?(i<d?(i+1==d?y:x):z):(i==d+1?w:v))+=Q[i]*Q[a-i];
g*=P[a];
if(Cnt[5])g*=modint(2)^(Cnt[5]-1),ansA+=(w+2*v)*g,ansB+=(2*x+y)*g,ansF+=(y+z+w)*g,ansS+=z*g;
else ansA+=(w+v)*g,ansB+=(x+y)*g,ansS+=z*g;
}
if(Cnt[0])g=modint(2)^Cnt[0],ansA*=g,ansB*=g,ansF*=g,ansS*=g;
ansA.print(),putchar(' '),ansB.print(),putchar(' '),ansF.print(),putchar(' '),ansS.println();
}
int main()
{
#ifdef MYEE
freopen("QAQ.in","r",stdin);
freopen("QAQ.out","w",stdout);
#endif
P[0]=1;for(uint i=1;i<=1000000;i++)P[i]=P[i-1]*i;
Q[1000000]=P[1000000].inv();for(uint i=1000000;i;i--)Q[i-1]=Q[i]*i;
A[12233]=A[33221]=A[23231]=A[23123]=A[12323]=A[23312]=A[31223]=A[31232]=A[32312]=A[33122]=0;
A[32123]=1,A[23132]=2,A[33212]=A[32321]=A[23321]=3,A[31322]=A[13232]=A[13223]=4;
A[23213]=A[21323]=A[22133]=5,A[21233]=6,A[22313]=7;
uint t;scanf("%*u%u",&t);while(t--)solve();
return 0;
}
// 那就是希望。
// 即便需要取模,也是光明。
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 5
Accepted
time: 8ms
memory: 26448kb
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 0 1 0 0 0 2 0 1 0 1 0 0 0 2 1 0 ...
result:
ok 400 numbers
Test #2:
score: 5
Accepted
time: 6ms
memory: 26660kb
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 2 1 4 16 8 4 0 12 0 4 16 4 8 4 0 2 0 2 0 0 0 2 8 4 0 4 0 10 4 2 8 0 4 4 4 22 0 6 0 2...
result:
ok 400 numbers
Test #3:
score: 5
Accepted
time: 13ms
memory: 26456kb
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 128 64 0 232 16 8 56 128 48 24 96 64 64 32 40 192 16 8 128 64 32 32 0 224 16 16 16 208 16 16 128 80 24 24 192 16 32 16 0 224 16 16 176 48 0 32 128 32 64 32 192 16 32 16 80 80 0 96 16 176 32 32 128 64 32 32 32 200 16 8 152 32 48 24 80 80 64 32 128 32 48 48 80 128 0 48 40...
result:
ok 400 numbers
Test #4:
score: 5
Accepted
time: 14ms
memory: 26324kb
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 96 48 368 512 96 48 128 704 128 64 416 416 128 64 320 512 128 64 320 416 192 96 544 288 128 64 512 192 160 160 128 704 128 64 0 896 64 64 752 128 96 48 288 544 128 64 368 512 96 48 832 64 64 64 64 576 256 128 256 512 128 128 560 176 192 96 512 368 96 48 608 320 0 96 512 192 160 160 192 768 0...
result:
ok 400 numbers
Test #5:
score: 5
Accepted
time: 31ms
memory: 26396kb
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 451252114 0 0 1 0 0 0 131072 0 462894643 0 1 0 0 0 763410233 0 0 242222522 242222522 805483386 0 0 1 0 0 0 886807583 16383 0 0 1 0 860243854 0 1 0 0 0 942525968 65535 0 0 1 0 0 942525968 942525968 0...
result:
ok 400 numbers
Test #6:
score: 5
Accepted
time: 41ms
memory: 26412kb
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 842690390 0 0 0 133505680...
result:
ok 400 numbers
Test #7:
score: 5
Accepted
time: 8ms
memory: 26812kb
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 616118644 0 0 0 6...
result:
ok 400 numbers
Test #8:
score: 5
Accepted
time: 37ms
memory: 26528kb
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 925851223 6...
result:
ok 400 numbers
Test #9:
score: 5
Accepted
time: 13ms
memory: 26348kb
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 386822154 0 839966267 127683925 14082...
result:
ok 400 numbers
Test #10:
score: 5
Accepted
time: 74ms
memory: 26400kb
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 335337504 37938615 0 329501543 118490378 714032319 0 868499318 831255045 305910895 0 563856075 0 705279817 0 995742198 982523351 906099528 0 810643489 398014437 109520096 0 195243129 0 0 0 702777662 486613555 369377464 0 845030996 31045...
result:
ok 400 numbers
Test #11:
score: 5
Accepted
time: 6ms
memory: 26396kb
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 0 32768 32768 65...
result:
ok 400 numbers
Test #12:
score: 5
Accepted
time: 67ms
memory: 26528kb
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 460789163 0 806788805 272500237 228650626 545659368 545659368 320812140 0 136706553 136706553 530270951 0 0 63954295 338739530 349282822 951345800 951345800 766080882 144707713 340840502 340840502 0 0 0...
result:
ok 400 numbers
Test #13:
score: 5
Accepted
time: 11ms
memory: 26496kb
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 2048 1024 1280 13568 0 1536 9792 4672 1280 640 10112 4352 1280 640 4096 10240 1536 512 8192 5888 1536 768 2048 12032 1536 768 13568 1280 1024 512 0 0 0 16384 15876 396 88 24 0 0 8192 8192 2048 12288 1024 1024 0 0 0 16384 14912 320 576 576 2048 12800 1024 512 5120 8960 1536...
result:
ok 400 numbers
Test #14:
score: 5
Accepted
time: 93ms
memory: 26476kb
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 928130740 619889036 194353719 0 585550540 585550540 198024949 0 583714925 583714925 168935695 886558158 0 309960946 613456471 348504046 747623136 654115499 895483140 623073264 368961478 476181270 88353558 648410782 813467406 813467406 0 0 183605223 183605223 0 0 0 367210446 917755086 568...
result:
ok 400 numbers
Test #15:
score: 5
Accepted
time: 4ms
memory: 26320kb
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 256 128 512 3008 384 192 1024 1024 1024 1024 3456 256 256 128 2048 1472 384 192 4064 0 0 32 2688 448 480 480 4032 0 32 32 1280 2240 384 192 0 3968 0 128 3408 352 168 168 704 2240 768 384 4095 0 0 1 4064 0 0 32 2048 0 1536 512 3632 134 165 165 4095 0 0 1 864 2656 384 192 2304...
result:
ok 400 numbers
Test #16:
score: 5
Accepted
time: 9ms
memory: 26436kb
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 202402848 633576084 0 487458002 683875200 683875200 301339126 658321087 29122532 866425657 682988465 0 0 173975584 0 79011881 623353314 154598854 996507569 816670757 198383443 841890986 625333936 813139915 465085349 949893555 0 500720912 677243745 677243745 138596030 159896806 83655...
result:
ok 400 numbers
Test #17:
score: 5
Accepted
time: 17ms
memory: 26396kb
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 33722628 802140589 58130126 697177505 277967707 503230403 714800214 985152346 417365540 417431994 292040797 644148641 945708069 652852587 725096468 0 904826813 904826813 700062037 914317224 959307593 959307593 475115377 549213686 0 512176678 200145646 554722456 494941356 28669628...
result:
ok 400 numbers
Test #18:
score: 5
Accepted
time: 27ms
memory: 26476kb
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 995304472 102156400 968788971 297290784 0 417454390 77507907 0 792253080 0 1 6930546 119718094 622924258 42680183 889003663 937461334 867023241 95253549 295918826 886988668 774252550 831581743 70806754 906939031 415550585 397201064 950201908 928795408 974922736 933066088 0 992745041 897998...
result:
ok 400 numbers
Test #19:
score: 5
Accepted
time: 85ms
memory: 26492kb
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 619903515 950564313 950795592 478992016 770435371 576677595 591656841 924757542 622868165 159318990 710817126 816121154 261800132 599255795 740584742 746857375 661124995 0 11535100 462503812 677126450 964185841 313945720 955101253 536332090 297028812 629299668 683236993 871936240 151270015...
result:
ok 400 numbers
Test #20:
score: 5
Accepted
time: 89ms
memory: 26328kb
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 460458484 678790237 33708150 368409811 517378074 500021435 674766003 191397615 644641951 906956254 147133476 732971372 212424823 326987799 65716750 475890455 763033128 114877137 0 0 709758735 709758735 360370187 754566429 507321498 795503709 247447503 632861954 11882597 527325416...
result:
ok 400 numbers
Extra Test:
score: 0
Extra Test Passed