QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#872437 | #9912. 比赛 | Crysfly | 100 ✓ | 320ms | 44244kb | C++11 | 5.5kb | 2025-01-26 01:37:14 | 2025-01-26 01:37:15 |
Judging History
answer
// what is matter? never mind.
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
return f?-x:x;
}
#define mod 998244353
struct modint{
unsigned int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x<o.x?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define poly vector<modint>
const modint G=3,Ginv=modint(1)/3;
inline poly one(){poly a;a.push_back(1);return a;}
vector<int>rev;
int rts[2100000];
inline int ext(int n){
int k=0;
while((1<<k)<n)++k;return k;
}
inline void init(int k){
int n=1<<k;
rts[0]=1,rts[1<<k]=qpow(31,1<<(21-k)).x;
Rep(i,k,1)rts[1<<(i-1)]=1ull*rts[1<<i]*rts[1<<i]%mod;
For(i,1,n-1)rts[i]=1ull*rts[i&(i-1)]*rts[i&-i]%mod;
}
void ntt(poly&a,int k,int typ){
int n=1<<k;
static ull tmp[2100000];
for(int i=0;i<n;++i)tmp[i]=a[i].x;
if(typ==1){
for(int l=n>>1;l>=1;l>>=1){
ull*k=tmp;
for(int*g=rts;k<tmp+n;k+=(l<<1),++g){
for(ull*x=k;x<k+l;++x){
int o=x[l]%mod*(*g)%mod;
x[l]=*x+mod-o,*x+=o;
}
}
}
for(int i=0;i<n;++i)a[i].x=tmp[i]%mod;
}else{
for(int l=1;l<n;l<<=1){
ull*k=tmp;
for(int*g=rts;k<tmp+n;k+=(l<<1),++g){
for(ull*x=k;x<k+l;++x){
int o=x[l]%mod;
x[l]=(*x+mod-o)*(*g)%mod,*x+=o;
}
}
}
int iv=qpow(n,mod-2).x;
for(int i=0;i<n;++i)a[i].x=tmp[i]%mod*iv%mod;
reverse(a.begin()+1,a.end());
}
}
poly operator +(poly a,poly b){
int n=max(a.size(),b.size());a.resize(n),b.resize(n);
For(i,0,n-1)a[i]+=b[i];return a;
}
poly operator -(poly a,poly b){
int n=max(a.size(),b.size());a.resize(n),b.resize(n);
For(i,0,n-1)a[i]-=b[i];return a;
}
poly operator *(poly a,modint b){
int n=a.size();
For(i,0,n-1)a[i]*=b;return a;
}
poly operator *(poly a,poly b){
if(!a.size()||!b.size())return {};
if((int)a.size()<=32 || (int)b.size()<=32){
poly c(a.size()+b.size()-1,0);
for(int i=0;i<a.size();++i)for(int j=0;j<b.size();++j)c[i+j]+=a[i]*b[j];
return c;
}
int n=(int)a.size()+(int)b.size()-1,k=ext(n);
a.resize(1<<k),b.resize(1<<k);
ntt(a,k,1),ntt(b,k,1);
For(i,0,(1<<k)-1)a[i]*=b[i];
ntt(a,k,-1),a.resize(n);return a;
}
poly Tmp;
poly pmul(poly a,poly b,int n,bool ok=0)
{
int k=ext(n);
a.resize(1<<k),ntt(a,k,1);
if(!ok) b.resize(1<<k),ntt(b,k,1),Tmp=b;
For(i,0,(1<<k)-1)a[i]*=Tmp[i];
ntt(a,k,-1),a.resize(n);
return a;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 3005
#define inf 0x3f3f3f3f
int n;
char s[maxn];
modint f[maxn],g[maxn];
modint res[maxn*2];
int calcF(modint *f){
int now=0,m=0;
f[0]=1;
For(i,1,n){
if(s[i]=='B')++now;
else{
Rep(i,m,0)f[i+1]+=f[i]*(now-i);
++m;
}
}
return m;
}
modint t[maxn][maxn],tt[maxn];
signed main()
{
init(18);
n=read(),scanf("%s",s+1);
initC(n+1);
int m1=calcF(f);
For(i,1,n)s[i]=s[i]^'R'^'B';
int m2=calcF(g);
For(i,1,n)s[i]=s[i]^'R'^'B';
For(i,0,m1) if(f[i].x) For(j,0,m2) if(g[j].x) t[i][j]=f[i]*g[j]*fac[n-i-j-1];
poly G(m1+1);
For(i,0,m1) G[i]=ifac[i]*sign(i);
reverse(G.begin(),G.end());
For(j,0,m2) {
poly F(m1+1);
For(i,0,m1) F[i]=t[i][j]*fac[i];
F=pmul(F,G,SZ(F)+SZ(G)-1,j>0);
// F=F*G;
For(i,0,m1) t[i][j]=F[i+m1]*ifac[i];
}
G.resize(m2+1);
For(i,0,m2) G[i]=ifac[i]*sign(i);
reverse(G.begin(),G.end());
For(i,0,m1){
poly F(m2+1);
For(j,0,m2) F[j]=t[i][j]*fac[j];
F=pmul(F,G,SZ(F)+SZ(G)-1,i>0);
For(j,0,m2) {
int to=n-j*2+i;
if(to>=0 && to<=n*2)res[to]+=F[j+m2]*ifac[j];
}
}
For(i,0,n*2) cout<<res[i].x<<" "; cout<<"\n";
return 0;
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 42360kb
input:
17 RRBRBRRRBBRRBBBBB
output:
0 24883200 242611200 501356541 849327599 494325665 823181277 903086281 266727081 332891457 910769886 319278309 251084707 537868029 253839295 412441055 638651452 562229207 730747129 511349760 4043520 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 35 numbers
Test #2:
score: 10
Accepted
time: 2ms
memory: 42476kb
input:
14 RBRBBBRBRBRBRB
output:
0 0 0 162 10062 360546 3876582 28262586 118720710 362734314 769743006 207566581 409796473 179843989 746858754 304375278 89275314 10653918 209466 0 0 0 0 0 0 0 0 0 0
result:
ok 29 numbers
Test #3:
score: 10
Accepted
time: 0ms
memory: 43968kb
input:
16 RBRBBRBBRRRRBRRR
output:
0 0 0 0 0 0 0 0 0 7464960 189112320 805787647 102289397 607018967 263100304 760262444 725591771 330725079 212483889 738101147 418922469 740663294 62208000 0 0 0 0 0 0 0 0 0 0
result:
ok 33 numbers
Test #4:
score: 10
Accepted
time: 1ms
memory: 44244kb
input:
15 BBBRBBBBBBBRBBB
output:
0 0 0 0 0 0 0 0 0 0 0 569397247 734051576 543732211 551111645 463249905 893070070 569397247 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 31 numbers
Test #5:
score: 10
Accepted
time: 1ms
memory: 42492kb
input:
16 BBBBBBBBBRRBBBBB
output:
0 0 0 0 0 0 0 0 0 0 0 0 595832823 580263879 355704698 695840452 92223157 421936853 227196767 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 33 numbers
Test #6:
score: 10
Accepted
time: 2ms
memory: 43608kb
input:
15 BBBBBBBBBBRBBBB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 756797435 193421293 193421293 185636821 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 31 numbers
Subtask #2:
score: 10
Accepted
Test #7:
score: 10
Accepted
time: 0ms
memory: 43200kb
input:
30 BRBRRBRBBRBRBBRBBRBBRBBRBBRRBR
output:
0 0 0 0 0 0 0 0 0 472322155 341149300 936998100 663102283 980872253 804068473 305737372 759992827 435714306 53578403 194953860 138874148 917648147 411689713 842676190 596563600 507144388 897742572 313213524 497244336 51840810 817612587 54680186 71915231 72873026 821631943 995017144 498609486 3059714...
result:
ok 61 numbers
Test #8:
score: 10
Accepted
time: 4ms
memory: 43964kb
input:
22 BBRBBBBBBRRBBBBBRBBRRR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 924987037 156012064 107229157 248572175 432214610 406077427 757195611 771797280 158444708 188622978 686829181 401546354 42086613 449742960 705260458 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 45 numbers
Test #9:
score: 10
Accepted
time: 2ms
memory: 42720kb
input:
20 BBRRBRBRRBRBRBBBRBBR
output:
0 0 0 0 0 286654464 222724085 735477518 879768762 657155621 374608160 460760901 656626201 53371769 887650550 244126084 566589532 369043471 13985447 545833072 665867348 402681618 982192403 980096579 75631823 459258583 316493810 14432256 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 41 numbers
Test #10:
score: 10
Accepted
time: 3ms
memory: 43612kb
input:
30 BBBBBBBBBBBBRRRRRRRRRRRRRRRRRR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 72334032 773765874 668869580 537072304 212520714 45699554 506161101 586251470 769359418 430456696 225960959 730416214 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 61 numbers
Test #11:
score: 10
Accepted
time: 0ms
memory: 43472kb
input:
30 BBBBBBBBBBBBBBBBBBRRBBBBBBBBBR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 932292693 684973968 256288178 934546083 837322348 421266285 493934008 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 61 numbers
Test #12:
score: 10
Accepted
time: 0ms
memory: 44188kb
input:
30 BBBBBBBBBBBBBBRRBBBBBBBBBBBBBR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 134057753 834266559 817644314 588299868 727219703 470864360 988271006 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok 61 numbers
Subtask #3:
score: 10
Accepted
Test #13:
score: 10
Accepted
time: 2ms
memory: 42948kb
input:
50 BBBRRRBRRRBBRBRRRBRRRBRRRRRRRBBRRRBBBRRBRRRBBRRRBR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 840671540 723021899 421289556 784273730 313155366 411853797 393531340 678567 633540304 934617986 894818850 619909812 260582295 277020059 767648419 229952267 653528115 836441240 93744680 503596241 14610311 176768975 411266579 97000158 68055577 77093992 819156...
result:
ok 101 numbers
Test #14:
score: 10
Accepted
time: 1ms
memory: 43604kb
input:
30 BRRBRBRRBBBRRBBBBBRBRRBRBBRBBB
output:
0 0 0 0 0 0 577002683 677691869 405169704 881214934 522606625 485568739 268429513 865028369 394347342 453955082 864056906 944433445 145565620 567872744 393691753 186892897 922995475 732239080 38136676 808302887 475120602 534045005 594213186 396919948 513486569 540062329 366918440 444240351 247203479...
result:
ok 61 numbers
Test #15:
score: 10
Accepted
time: 4ms
memory: 43532kb
input:
46 BBBBRBBRBBBRRRRRBRBRBRRBRRRBRBBBBRBRBRRBBRRBRR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 660761508 644702590 897844805 750106369 686938853 932481915 574174221 294213960 668854749 706431613 100498282 960168080 353092076 343099522 183983669 107126533 718310464 498363183 369572616 972830870 716934606 763584223 595161946 338630761 717786690 849278305 262900429 ...
result:
ok 93 numbers
Test #16:
score: 10
Accepted
time: 1ms
memory: 43860kb
input:
50 BBBBBBBBBBBBBBBBRRRRRRRRRRRRRRRRBBBBBBBBBBBBBBBBBB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 831392418 604328086 961184705 819434558 450033872 572811813 637284475 638881547 844766974 157789854 461172724 939131107 246938607 141044738 596024030 462151101 314563907 17327804 409217009 118114813 134339259 787410036 777008722 896388601 748783660 851950968 85661...
result:
ok 101 numbers
Test #17:
score: 10
Accepted
time: 2ms
memory: 42940kb
input:
49 RBBBBBRBRBBBBBBBBBBBBBBBBRBBBBBRBBBBRBBBBBBBBBBBR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 607905029 969689245 927531367 354997122 672606662 890595880 747744666 352270561 749008986 17901987 544305436 246979810 221979365 894641324 406170420 985309021 772832843 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 99 numbers
Test #18:
score: 10
Accepted
time: 2ms
memory: 43084kb
input:
50 BBBBBBBBBBRBBBBBBBBBBBBBRBBBBBRBRBBBBBBBBBBBBBBBRB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 662189982 50268982 516797152 800043454 523612648 23838524 677535558 4054488 381467635 589829657 587271506 883407480 54487000 290015930 597531274 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 101 numbers
Subtask #4:
score: 10
Accepted
Test #19:
score: 10
Accepted
time: 1ms
memory: 43844kb
input:
200 RBRBRBBRBRBRRBBRBBRBRBBBRBRRBRBRBRRBRRRBRRBRRRRRBRBBRRBBRBBRBBBBRBRBRBBBRRBBRBRRRBRBRBBBBRBRRRBBBBRRRBRBBRBBBRRRRRBRRRRRBRRRRRRRBBRRBRBBRBBRRRBRRRBRRRRBRBRBRRBBRBBRRBRRRRBBRRBRBRBRRRRBBRBRRBBRRBRBBBBR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 745609274 908685790 381548860 264974180 959826982 760604252 483130221 835386541 316125466 260589275 814282660 145470527 384293777 365073535 965306655 674115093 763471295 941625609 834987587 385920270 296085371 863016777 168400617 385101278 31...
result:
ok 401 numbers
Test #20:
score: 10
Accepted
time: 1ms
memory: 43076kb
input:
127 BRBBBRRRBBRRBRBBBRRRBBBRRRBBBBBRBBBBBRBBRRBBBRBBRBRBBRRBBRRBRBRBRBBBBBRRRBRBBBRRBBBBRRBRRBRBBRRRBRBBBRRRBBRRRBBRRBRBRBBBRRBRRBB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 892965774 607306820 653562192 706656579 249289590 168840319 746524666 910950632 820231829 24281672 328887776 681054091 310407940 294888860 527266886 658228102 389793690 762714214 43951323 383435616 55968202 898934801 161585759 971473439 774966775 570051632...
result:
ok 255 numbers
Test #21:
score: 10
Accepted
time: 3ms
memory: 42456kb
input:
189 BBRBBRRBBRRRBBRBRRBRBBBBRRBBBBBRBRBRRBBRBRRRRBRRRBRRBBBRBRRRBBBRRBRRRBRBBBRBRRRRBRBRBRRBBBRRRBRBRBBRBBRBBBBRRBBBRBRBBRRRRBBRBBBRRRRRBBRRRRRRRRBRBRBBRRRBRRBRBRBRRBRBRBRBBBRBRBRRRBRBRRBBBRBBR
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 531665400 25736208 604919590 590386634 974667105 292393819 703257642 868394065 735413210 212769177 223384193 263497431 768513865 137480479 359064465 215776751 418095264 370622263 122824293 545709278 172213253 426810265 431481313 439059761 732850090 9619858...
result:
ok 379 numbers
Test #22:
score: 10
Accepted
time: 2ms
memory: 43108kb
input:
197 RBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRRRRRRRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBBBBBBBBBBBBBBBBRRRRRRRRRRRRRRRRRRRRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23625400 731155554 707954979 756051993 710417147 268240200 527021965 302263442 283629134 387948987 133643929 914803161 789693911 426823172 55389...
result:
ok 395 numbers
Test #23:
score: 10
Accepted
time: 3ms
memory: 43300kb
input:
197 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBRBBBBBBRBBRRBBBBBRBBBBRRBBBBBRBBBBBBBBRBBBBBBBBBBBBBBBBBRBBBBBBBBBRBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBRRBRBBBBBBBBBBBBBBBBBBBBRBBBBBB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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RRBBRRBRRRRRBBBRBRRRRBBBBRBBBRBBBRBBBBRRBRRBRRRBBBBRRBBRRBBBBRRRRBBBBBBBBBRBRRBBRBRBBRRRBBBRBRRRBBBRRBBRBB...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 557061980 186269289 444189710 230697705 508641687 934495048 329130298 792587329 138389867 833789844 76256670 982876673 503319722 576240453 77064253 152379867 ...
result:
ok 1001 numbers
Test #26:
score: 45
Accepted
time: 5ms
memory: 43984kb
input:
313 RBBBBRRRRBRRBBRBBRRRBRBBBBRBRBBBRRRRRBRRRRRRRRRBBBRBBBRBRRRRRRBRBRBRBBRBRBRBBBBRBRBRRBBRBBBRRBRBRBRBBBRBBBRRRBBBBRBRBBBBRBRRRRRBBRBRRRRRRRRBRRBBBRBBBRBRBBBBRBBBRRRBRRRBRRRRRRRRRBBBBRBBRRBBBRBRRRBRRBBRRBRBBRRBBRBBRBRBRRBBBRRBBRRRRBRBBRBRBRBRRRBBRRRRBRRBBRRBBRBRRRBBBBBRBRBBBBRBBRBBBBRBRRRBRRBBBRBB...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 436005134 952104281 320096321 438921536 911649102 405904725 507043550 230826607 127730010 646254933 622598835 521772078 770726636 463113202 417818883 28959106 297574251 164320962 973840364 987824841 220438466 677845303 338657166 99081793 731220672 203664062 841595425 ...
result:
ok 627 numbers
Test #27:
score: 45
Accepted
time: 4ms
memory: 43112kb
input:
256 RBBBBRBRBRRBBBBRRRBRBRRBBRRBBBBRBRBBRRBRBBBBRRBBBBBBBBRBRRRBBBRRBRBRRBBRRBRRBBBBBRBBRRBBBRRBBBBBRBRRBBBRBRRRRBBRBRRRRBBBRRBBBRBRBRBRRBBBBRBBRRBRRRBRBBRRRBRRBBRBRBRBRRBRBRRRRBRBRRRBRBRRRRRBRRBRBBBBRRBRBRRBRBRBRRBRRBRBRRBBBBBBRRBBRRBRRBBBBRRRRRBRRRRRRRBRRRRB
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 141079562 820642129 352234357 217463554 233271696 617710658 831607694 408310605 584523815 633652268 586201478 303401538 374688368 688218923 793774568 138833397 488592294 612399880 423852903 350184412 644126...
result:
ok 513 numbers
Test #28:
score: 45
Accepted
time: 5ms
memory: 42792kb
input:
499 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBBRR...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 999 numbers
Test #29:
score: 45
Accepted
time: 4ms
memory: 43348kb
input:
497 BBBBBBBBBBBBBBBBBBBBRBBBBBBRBBBBBBBBRBBBBBBBB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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 997 numbers
Subtask #6:
score: 15
Accepted
Test #31:
score: 15
Accepted
time: 320ms
memory: 43520kb
input:
3000 RRBBRRBRBBRRRRRBBRBRBRBBBBBRBBRRBBBBBRRBBBRBBBRRRBBRBBBBRRBBRRRRRRRBRRBBRRRRBBRBRRRRRBRRBRRRBRRRRRBBBRBBBRRBBBRRRBRBBBBBRBRBRBRBRBRBBRBRRRRRBBBBBRBBBRRRBBRRRBBRBBRBRBBRRBBRBBBRRBBRRBRBBRRBBBRRBRBRBRRRRRRBBBBRRRBBBRRRBBRRBRBRRBBRRBRRBBBRRRBBRBBBRBRRRRRRBRBBRRBRRBRBRBBBBRRRBBBRBBRBBBBRRRBRRBBBRRB...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 907051355 448050918 668364722 111653582 389509899 ...
result:
ok 6001 numbers
Test #32:
score: 15
Accepted
time: 226ms
memory: 43468kb
input:
2172 RBRRBRRRBRBRBRRRRBRBRBBRRBBBRRBRRRRRRBRRBRBBRBRRBBBBBRRRBBBRRBRRRBRRBRBBRBRBRRBBRBRRBRRRBRRBBBBRBRBBBRBRBBRRBBBRBRRRBBBRBRRBBBBBBRBBBBBRRRRRBBRBBBBRBBRRBRBRBBBBRBBBRBRRRRRBBRRRBBRRBRBBBRRRRBBBBRBRBBRRBBBRBRRRRRRRRBRRBBBRBRRBRRRBRRRBBBBRBBBBRRRBBBRRRRBBBRRBBBRBRRRBBBRBBBBRBRRBBBBBRBRRRRRBBRRBBBR...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 315099994 274068388 268727932 818010745 57026985 486662703 638076678 860610719 210202255 249259151 663743338 461350006 9505729...
result:
ok 4345 numbers
Test #33:
score: 15
Accepted
time: 261ms
memory: 42804kb
input:
2487 BBRRRRRRBBBBRRRRBRBBBRBBBRBBRBBBRBRRBRRRRBRRRRRBRRRBRBBBBBBRRBBRBBBRRRRRRRRRRRRBRBBBRBBRBBBRBBRBBBRBRBBBRRBRRBRBBBRBBBBRRRBRBRBRRRRBRRBBBBBBRBRRRBRRBBRBRRBRRRRBBBBRRRBRBBBBBBBRRBBRRRRRBRRBBBRRRBBRRRRBBRRRBRRBRBRBBBBRRBRBBBBRRBRRBRRBBRRBBBRRRRRBRBRBBBRBRRRRRRBRBRRRRRRBRBBRBRRBBRBBBRBBRRRBBRRRRRB...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 307048890 175787020 591185239 923927183 476883383 780304058 581447369 601348966 551843062 916346176 275446106 85...
result:
ok 4975 numbers
Test #34:
score: 15
Accepted
time: 89ms
memory: 42972kb
input:
3000 RRRR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