QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#739379 | #9625. 魔弹 | I_be_wanna | AC ✓ | 365ms | 117988kb | C++14 | 9.8kb | 2024-11-12 21:36:11 | 2024-11-12 21:36:14 |
Judging History
answer
#include<bits/stdc++.h>
#define re register
using namespace std;
struct Poly998244353{
const int M=998244353;
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline void Out(vector<int>A){
puts("\n--------");
printf("%d\n",A.size());
for(re int i=0;i<A.size();++i)printf("%d ",A[i]);
puts("");
puts("--------\n");
}
int N,W[2097152],rev[2097152],wi[2097152];
inline void pre(re int n){
re int wn=ksm(3,(M-1)/n);N=n;
for(re int i=W[0]=1;i<n;++i)W[i]=1ll*W[i-1]*wn%M;
}
inline int make(re int n){
re int l=ceil(log2(n));n=1<<l;
for(re int i=0;i<n;++i)rev[i]=rev[i>>1]>>1|((i&1)<<(l-1));
return n;
}
inline void NTT(vector<int>&A,re int n,re int f){
for(re int i=0;i<n;++i)if(i<rev[i])swap(A[i],A[rev[i]]);
for(re int i=1;i<n;i<<=1){
for(re int j=0;j<i;++j)wi[j]=W[f==1?j*(N/(i<<1)):(j?(N-j*(N/(i<<1))):j)];
for(re int j=0;j<n;j+=i<<1)
for(re int k=j;k<j+i;++k){
re int x=A[k],y=1ll*A[k+i]*wi[k-j]%M;
add(A[k],y),A[k+i]=Mod(x-y+M);
}
}
if(f==-1){
re int iv=ksm(n,M-2);
for(re int i=0;i<n;++i)A[i]=1ll*A[i]*iv%M;
}
}
inline void mul(vector<int>A,vector<int>B,vector<int>&C){
re int k=make(A.size()+B.size()-1),o=A.size()+B.size()-1;
A.resize(k),B.resize(k),C.resize(k);
NTT(A,k,1),NTT(B,k,1);
for(re int i=0;i<k;++i)C[i]=1ll*A[i]*B[i]%M;
NTT(C,k,-1),C.resize(o);
}
}Poly998;
struct Poly1004535809{
const int M=1004535809;
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline void Out(vector<int>A){
puts("\n--------");
printf("%d\n",A.size());
for(re int i=0;i<A.size();++i)printf("%d ",A[i]);
puts("");
puts("--------\n");
}
int N,W[2097152],rev[2097152],wi[2097152];
inline void pre(re int n){
re int wn=ksm(3,(M-1)/n);N=n;
for(re int i=W[0]=1;i<n;++i)W[i]=1ll*W[i-1]*wn%M;
}
inline int make(re int n){
re int l=ceil(log2(n));n=1<<l;
for(re int i=0;i<n;++i)rev[i]=rev[i>>1]>>1|((i&1)<<(l-1));
return n;
}
inline void NTT(vector<int>&A,re int n,re int f){
for(re int i=0;i<n;++i)if(i<rev[i])swap(A[i],A[rev[i]]);
for(re int i=1;i<n;i<<=1){
for(re int j=0;j<i;++j)wi[j]=W[f==1?j*(N/(i<<1)):(j?(N-j*(N/(i<<1))):j)];
for(re int j=0;j<n;j+=i<<1)
for(re int k=j;k<j+i;++k){
re int x=A[k],y=1ll*A[k+i]*wi[k-j]%M;
add(A[k],y),A[k+i]=Mod(x-y+M);
}
}
if(f==-1){
re int iv=ksm(n,M-2);
for(re int i=0;i<n;++i)A[i]=1ll*A[i]*iv%M;
}
}
inline void mul(vector<int>A,vector<int>B,vector<int>&C){
re int k=make(A.size()+B.size()-1),o=A.size()+B.size()-1;
A.resize(k),B.resize(k),C.resize(k);
NTT(A,k,1),NTT(B,k,1);
for(re int i=0;i<k;++i)C[i]=1ll*A[i]*B[i]%M;
NTT(C,k,-1),C.resize(o);
}
}Poly100;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
const int M=998244353;
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
const int HM=10000019;
struct Hash{
int H[HM+1],cnt,nx[4000002],id[4000002],to[4000002];
inline Hash(){memset(H,cnt=0,sizeof(H));}
inline int& operator [] (const int x){
int p=x%HM;
for(int i=H[p];i;i=nx[i])if(to[i]==x)return id[i];
return nx[++cnt]=H[p],to[H[p]=cnt]=x,id[cnt];
}
inline bool Ask(const int x){
int p=x%HM;
for(int i=H[p];i;i=nx[i])if(to[i]==x)return 1;
return 0;
}
}mp;
int n,G,pw,B,Log[100002],Inv,Iv=ksm(1004535809-M,M-2),L[100002],R[100002],ans[100002];
char s[100002],ip[100002];
inline int Ask(int x){
int s=0;
while(!mp.Ask(x))x=1ll*x*Inv%M,++s;
return mp[x]+s;
}
inline vector<int> Conv(vector<int>A,vector<int>B){
vector<int>C1,C2,C;
Poly998.pre(Poly998.make(A.size()+B.size())),Poly100.pre(Poly100.make(A.size()+B.size()));
Poly998.mul(A,B,C1),Poly100.mul(A,B,C2),C.resize(C1.size());
for(re int i=0;i<C.size();++i){
long long tmp=C2[i];
int dlt=Mod(C1[i]-C2[i]%M+M);
tmp+=1ll*dlt*Iv%M*1004535809;
C[i]=tmp%(M-1);
}
return C;
}
int main(){
n=read(),G=3,B=300,Log[1]=0,pw=1;
for(int i=1;i<=B;++i)pw=1ll*pw*G%M;
re int ss=1;Inv=ksm(3,M-2);
for(int i=0;i<=M;i+=B)mp[ss]=i,ss=1ll*ss*pw%M;
for(int i=2;i<=n;++i){
if(!ip[i]){
Log[i]=Ask(i);
for(int j=2;j*i<=n;++j)
Log[j*i]=(Log[i]+Log[j])%(M-1),ip[j*i]=1;
}
}
scanf("%s",s+1);
vector<int>A,B,C;A.resize(n+1),B.resize(n+1);
for(re int i=0;i<=n;++i)A[i]=(Log[i]-Log[i+1]+M-1)%(M-1);
for(re int i=1;i<=n;++i)B[i]=(s[i]=='R')?1:0;
C=Conv(A,B);
for(re int i=1;i<=n;++i)L[i]=C[i];
for(re int i=1;i<=n;++i)B[i]=(s[i]=='L')?1:0;
reverse(A.begin(),A.begin()+n+1);
C=Conv(A,B);
for(re int i=1;i<=n;++i)R[i]=C[i+n];
for(re int i=1;i<n;++i)if(s[i]=='L'&&s[i+1]=='R')ans[i]=ans[i+1]=ksm(3,L[i]+R[i+1]);
if(s[1]=='R')ans[1]=ksm(3,R[1]);
if(s[n]=='L')ans[n]=ksm(3,L[n]);
re int fac=1;
for(re int i=1;i<=n;++i)fac=1ll*i*fac%M;
for(re int i=1;i<n;++i)printf("%d ",1ll*ans[i]*fac%M);printf("%d",1ll*fac*ans[n]%M);
}
/*#include<bits/stdc++.h>
#define re register
using namespace std;
struct Poly998244353{
const int M=998244353;
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline void Out(vector<int>A){
puts("\n--------");
printf("%d\n",A.size());
for(re int i=0;i<A.size();++i)printf("%d ",A[i]);
puts("");
puts("--------\n");
}
int N,W[2097152],rev[2097152],wi[2097152];
inline void pre(re int n){
re int wn=ksm(3,(M-1)/n);N=n;
for(re int i=W[0]=1;i<n;++i)W[i]=1ll*W[i-1]*wn%M;
}
inline int make(re int n){
re int l=ceil(log2(n));n=1<<l;
for(re int i=0;i<n;++i)rev[i]=rev[i>>1]>>1|((i&1)<<(l-1));
return n;
}
inline void NTT(vector<int>&A,re int n,re int f){
for(re int i=0;i<n;++i)if(i<rev[i])swap(A[i],A[rev[i]]);
for(re int i=1;i<n;i<<=1){
for(re int j=0;j<i;++j)wi[j]=W[f==1?j*(N/(i<<1)):(j?(N-j*(N/(i<<1))):j)];
for(re int j=0;j<n;j+=i<<1)
for(re int k=j;k<j+i;++k){
re int x=A[k],y=1ll*A[k+i]*wi[k-j]%M;
add(A[k],y),A[k+i]=Mod(x-y+M);
}
}
if(f==-1){
re int iv=ksm(n,M-2);
for(re int i=0;i<n;++i)A[i]=1ll*A[i]*iv%M;
}
}
inline void mul(vector<int>A,vector<int>B,vector<int>&C){
re int k=make(A.size()+B.size()-1),o=A.size()+B.size()-1;
A.resize(k),B.resize(k),C.resize(k);
NTT(A,k,1),NTT(B,k,1);
for(re int i=0;i<k;++i)C[i]=1ll*A[i]*B[i]%M;
NTT(C,k,-1),C.resize(o);
}
}Poly998;
struct Poly1004535809{
const int M=1004535809;
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline void Out(vector<int>A){
puts("\n--------");
printf("%d\n",A.size());
for(re int i=0;i<A.size();++i)printf("%d ",A[i]);
puts("");
puts("--------\n");
}
int N,W[2097152],rev[2097152],wi[2097152];
inline void pre(re int n){
re int wn=ksm(3,(M-1)/n);N=n;
for(re int i=W[0]=1;i<n;++i)W[i]=1ll*W[i-1]*wn%M;
}
inline int make(re int n){
re int l=ceil(log2(n));n=1<<l;
for(re int i=0;i<n;++i)rev[i]=rev[i>>1]>>1|((i&1)<<(l-1));
return n;
}
inline void NTT(vector<int>&A,re int n,re int f){
for(re int i=0;i<n;++i)if(i<rev[i])swap(A[i],A[rev[i]]);
for(re int i=1;i<n;i<<=1){
for(re int j=0;j<i;++j)wi[j]=W[f==1?j*(N/(i<<1)):(j?(N-j*(N/(i<<1))):j)];
for(re int j=0;j<n;j+=i<<1)
for(re int k=j;k<j+i;++k){
re int x=A[k],y=1ll*A[k+i]*wi[k-j]%M;
add(A[k],y),A[k+i]=Mod(x-y+M);
}
}
if(f==-1){
re int iv=ksm(n,M-2);
for(re int i=0;i<n;++i)A[i]=1ll*A[i]*iv%M;
}
}
inline void mul(vector<int>A,vector<int>B,vector<int>&C){
re int k=make(A.size()+B.size()-1),o=A.size()+B.size()-1;
A.resize(k),B.resize(k),C.resize(k);
NTT(A,k,1),NTT(B,k,1);
for(re int i=0;i<k;++i)C[i]=1ll*A[i]*B[i]%M;
NTT(C,k,-1),C.resize(o);
}
}Poly100;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
const int M=998244353;
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
const int HM=10000019;
struct Hash{
int H[HM+1],cnt,nx[4000002],id[4000002],to[4000002];
inline Hash(){memset(H,cnt=0,sizeof(H));}
inline int& operator [] (const int x){
int p=x%HM;
for(int i=H[p];i;i=nx[i])if(to[i]==x)return id[i];
return nx[++cnt]=H[p],to[H[p]=cnt]=x,id[cnt];
}
inline bool Ask(const int x){
int p=x%HM;
for(int i=H[p];i;i=nx[i])if(to[i]==x)return 1;
return 0;
}
}mp;
int n,G,pw,B,Log[100002],Inv,Iv=ksm(1004535809-M,M-2),L[100002],R[100002],ans[100002];
char s[100002],ip[100002];
inline int Ask(int x){
int s=0;
while(!mp.Ask(x))x=1ll*x*Inv%M,++s;
return mp[x]+s;
}
inline vector<int> Conv(vector<int>A,vector<int>B){
vector<int>C1,C2,C;
Poly998.pre(Poly998.make(A.size()+B.size())),Poly100.pre(Poly100.make(A.size()+B.size()));
Poly998.mul(A,B,C1),Poly100.mul(A,B,C2),C.resize(C1.size());
for(re int i=0;i<C.size();++i){
for(re int i=1;i<n;++i)printf("%d ",1ll*ans[i]*fac%M);printf("%d",1ll*fac*ans[n]%M);
}*/
詳細信息
Test #1:
score: 100
Accepted
time: 67ms
memory: 96268kb
input:
2 RL
output:
1 1
result:
ok single line: '1 1'
Test #2:
score: 0
Accepted
time: 68ms
memory: 96080kb
input:
4 LLRR
output:
0 24 24 0
result:
ok single line: '0 24 24 0'
Test #3:
score: 0
Accepted
time: 71ms
memory: 92188kb
input:
4 RLRL
output:
9 6 6 9
result:
ok single line: '9 6 6 9'
Test #4:
score: 0
Accepted
time: 52ms
memory: 90472kb
input:
10 LRLRLLRRRR
output:
1088640 1088640 604800 604800 0 1935360 1935360 0 0 0
result:
ok single line: '1088640 1088640 604800 604800 0 1935360 1935360 0 0 0'
Test #5:
score: 0
Accepted
time: 56ms
memory: 94224kb
input:
10 LLRLLRLRLL
output:
0 725760 725760 0 725760 725760 483840 483840 0 1693440
result:
ok single line: '0 725760 725760 0 725760 725760 483840 483840 0 1693440'
Test #6:
score: 0
Accepted
time: 60ms
memory: 89972kb
input:
998 RLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLLRRRLRLLRLLRLRLRLLLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLLRLRLRLRLRLRLRLRRLRLLRLRLRLRLRLRLRRLRRLRRRLLRLLRLRLLRRLRLLLRLRLRRLRRLRLRLRRLRLRLLRLRLRLRLRLRLRLLRLRLRLRLRLLLRRLLRLRRLRRLRRLRLRLRLRLRLRLRLRLRLRLRLRLLRRLRRRLRRLRLRRLRLRLRLRLRLRLRLLRLLRRLRRLRLLRLRLRLRRLLRLRLRLLRRLRL...
output:
791892921 222105954 222105954 387243673 387243673 858332170 858332170 668690160 668690160 29037702 29037702 344898397 344898397 10138435 10138435 920091431 920091431 680236417 680236417 884390492 884390492 338820980 338820980 508576275 508576275 957551010 957551010 2459479 2459479 0 0 61773050 61773...
result:
ok single line: '791892921 222105954 222105954 ...0 632970969 632970969 464724562'
Test #7:
score: 0
Accepted
time: 61ms
memory: 94156kb
input:
998 RLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...
output:
439674742 509947875 509947875 815063904 815063904 891776804 891776804 553641803 553641803 13450200 13450200 267859496 267859496 385670319 385670319 882911667 882911667 109331874 109331874 0 128425033 128425033 836729978 836729978 854828800 854828800 123260213 123260213 415537062 415537062 26751346 2...
result:
ok single line: '439674742 509947875 509947875 ...2 773862752 498604661 498604661'
Test #8:
score: 0
Accepted
time: 68ms
memory: 90104kb
input:
1000 LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...
output:
255385 255385 948987885 948987885 944375949 944375949 391954880 391954880 918617102 918617102 509797789 509797789 963771001 963771001 168738152 168738152 967324970 967324970 550867915 550867915 149529568 149529568 490172856 490172856 731868859 731868859 286624466 286624466 277467460 277467460 496196...
result:
ok single line: '255385 255385 948987885 948987...4 705333897 705333897 531622062'
Test #9:
score: 0
Accepted
time: 75ms
memory: 96152kb
input:
998 LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...
output:
54273261 54273261 171633438 171633438 946148426 946148426 982991957 982991957 138042735 138042735 703892213 703892213 165685072 165685072 890250227 890250227 244374543 244374543 640936104 640936104 169345002 169345002 847600184 847600184 889380235 889380235 648465375 648465375 412924715 412924715 37...
result:
ok single line: '54273261 54273261 171633438 17...438 171633438 54273261 54273261'
Test #10:
score: 0
Accepted
time: 65ms
memory: 88760kb
input:
999 RLRRLRRRLLLLLLLRRRRLRLLRLRRLLLLRRLLRRRRLRRLRLLRRRLLLLLLRLLRRLRRLLRRRRLLLLRRRLRLRRLLLRRLLLRLLLRRLRRLRRRLLRLRRLRRLLLRLRLLRLRRLLRRRRRLRRRLRRLRLLRLLLLLLLRLLRLLLRRRRLRRLRLLLRRRLRLLRRLRLLRLRLRLLLRRLLLLRLRRRLLLLLLRRLLRLLLRRLRRRRRLLLRLRRLRLLLLRLLLRLLLRRRRLRLRRLRLLLLRLRLRLRLRLLRLLLLLLRRRLLLLLRRLLLLRLLLLR...
output:
831921527 841981814 841981814 0 802033891 802033891 0 0 0 0 0 0 0 0 313870399 313870399 0 0 0 845084145 845084145 0 202490903 202490903 292802290 292802290 0 0 0 0 246685715 246685715 0 0 750008183 750008183 0 0 0 627041700 627041700 0 129985167 129985167 0 414419357 414419357 0 0 0 0 0 0 0 69839104...
result:
ok single line: '831921527 841981814 841981814 ...9451543 0 0 73252857 73252857 0'
Test #11:
score: 0
Accepted
time: 58ms
memory: 90016kb
input:
1000 RRLRRLRLRLLRRRLRLRLRLLLRLLLRLRLLRLRRRLRRRRLLRLLLLRLLRLLRLRLRLLLLRRRRRLRLLLRLLRLRRLRLLLRRLLLLLRLRRRRLRRRLLLLRRLRLLLLLRRRRLLRLRLRLLRRRRRLLRRLRLRLLLLRRRRRLRRLLRRRLRRRRLRLLRRLLRRRLLLLRLLLLRRRRLRLLLLLRRRRLLLRLLRLRLRLRLRLRLRRLLLLRRRLRLLLRLLRRLRRRLLLLLLLLLLLRLLLLLLLRLLLRLRRLRLLLRLLRLLLLRLRLRLRLLRLRLLR...
output:
511795335 0 69779310 69779310 0 739828205 739828205 753376067 753376067 0 701671563 701671563 0 0 212012731 212012731 878780187 878780187 579239850 579239850 0 0 522816863 522816863 0 0 334242623 334242623 863711626 863711626 0 643092447 643092447 851181131 851181131 0 0 561587102 561587102 0 0 0 0 ...
result:
ok single line: '511795335 0 69779310 69779310 ...0 186342784 186342784 663982717'
Test #12:
score: 0
Accepted
time: 322ms
memory: 107896kb
input:
100000 LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL...
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 single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 215582594'
Test #13:
score: 0
Accepted
time: 293ms
memory: 117708kb
input:
100000 RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...
output:
215582594 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 single line: '215582594 0 0 0 0 0 0 0 0 0 0 ...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0'
Test #14:
score: 0
Accepted
time: 365ms
memory: 107628kb
input:
100000 RLRRLRLRRRLLLLRRLRRLRLRRLLRRRRRLLRLLRLRRLRLLRRRLLRRRRLRLLRRLRLLRRLRRLLLRRLLLLLRLRRLRLLLRRRLRRRLRRLRRRRRLLRRLLLRLRLLLRRLLRLLLRLLRLRRLRLRRRLLLRRLRRRRRRLLLLLLLLLLLRLLRRRLLRRLRRLLRLRLLLRRRLLRRLLLRLLLRRRRLLRLLRLRRRLLLLLRRRRRLLRRRLRLRLRRRLRRRRRLRLRLRLLRRLRRLRRLLRRRLRRRLRLRRRRLRRLLRLLLLLRRRLLLRLRRRL...
output:
655182588 424061777 424061777 0 532898281 532898281 250301765 250301765 0 0 0 0 0 258617217 258617217 0 36972119 36972119 0 990202488 990202488 808928429 808928429 0 0 24205425 24205425 0 0 0 0 0 421610174 421610174 0 84739313 84739313 311210211 311210211 0 731382457 731382457 0 140895153 140895153 ...
result:
ok single line: '655182588 424061777 424061777 ...883051157 883051157 0 981459997'
Test #15:
score: 0
Accepted
time: 347ms
memory: 106876kb
input:
100000 LLRRRLRLLRLLRLRLLLRLRLLRRLRRRLRLRRRRLLLLLRLRRLRLLRLRLRRLRRLLLLRRRRRLRLRLRRRRLLLLLRLLRLLRRRRRLLRRLRRRRRRRLRLRRRLLRLRRLRRRRRRLLRRLRLRLRLLRLRRLLLRLLLRRRRLLLLLRLRLLRRLLRLLRLLLLRLRLRRRLLRRLLLLLLLLRLLLLLRLLLRLRRRLRRRRRRLRRRLRRLRLRLLRLLRLLRRLRRLLRRRLRLRLRRLRRRLLRRLRLRRLRLRLRLRLRRLRLRRLRRRLLRLRLLRLLR...
output:
0 622368831 622368831 0 0 312222703 312222703 0 644221684 644221684 0 174202506 174202506 871543980 871543980 0 0 935237676 935237676 854058755 854058755 0 524939144 524939144 0 835495707 835495707 0 0 811694651 811694651 8567849 8567849 0 0 0 0 0 0 0 778008990 778008990 273531778 273531778 0 663941...
result:
ok single line: '0 622368831 622368831 0 0 3122...2874130 472874130 0 0 915577668'
Test #16:
score: 0
Accepted
time: 364ms
memory: 117988kb
input:
99999 RLLRLRLLRRLRLLRRLRLRLRRRLRLRRLLRLRLLRLRLRLRLRLLRRLLLRLRLRLLLRRLRLRLRLRLRLRRLRLRLRRLRLRLRLRLLLRRLRLRLRLRLRLRLRLRLRLLRLRRLRLRLRLRLLRLLRLRLRLRRRRLRLRLRLRLRLLLRRLRLRLRLRRLRLRLLRLRLRRLRLLRLRLRLRLRLRRLRLRRLRLLRLRLRLRLLRLRLRLRRLRLRLRLRLRLRLRRLRLRLRLRLRLLLLRLRRLRLRLRLRLLRRLRLRLRLRLRLRLRLRLRLLRLRLRLRLR...
output:
857597950 0 938643316 938643316 546642845 546642845 0 9325804 9325804 0 253386790 253386790 0 284892971 284892971 0 406121179 406121179 126656527 126656527 120800890 120800890 0 0 845318793 845318793 921533342 921533342 0 0 2601538 2601538 197822400 197822400 0 396731107 396731107 562366338 56236633...
result:
ok single line: '857597950 0 938643316 93864331...6 942066999 942066999 623799230'
Test #17:
score: 0
Accepted
time: 365ms
memory: 105188kb
input:
99998 LRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRL...
output:
227224847 227224847 688276241 688276241 272269422 272269422 840415038 840415038 709217006 709217006 968282991 968282991 737355553 737355553 593823485 593823485 660168773 660168773 9561283 9561283 0 296353266 296353266 11637670 11637670 944463953 944463953 30674812 30674812 119782681 119782681 392995...
result:
ok single line: '227224847 227224847 688276241 ...143872896 521994131 521994131 0'
Test #18:
score: 0
Accepted
time: 359ms
memory: 107572kb
input:
99999 LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...
output:
657380282 657380282 506001932 506001932 476316674 476316674 769232758 769232758 794446371 794446371 469914731 469914731 877622223 877622223 311033786 311033786 280018681 280018681 466641023 466641023 492736654 492736654 229669458 229669458 589920046 589920046 155576401 155576401 612972851 612972851 ...
result:
ok single line: '657380282 657380282 506001932 ...1 137963976 137963976 871464933'
Test #19:
score: 0
Accepted
time: 306ms
memory: 106880kb
input:
99999 LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...
output:
735518182 735518182 261975641 261975641 309450675 309450675 300206665 300206665 354220722 354220722 112132541 112132541 735542082 735542082 599471705 599471705 666404521 666404521 43471739 43471739 721884769 721884769 776311760 776311760 966903300 966903300 156484024 156484024 673316931 673316931 44...
result:
ok single line: '735518182 735518182 261975641 ...5 261975641 261975641 735518182'