QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#597956 | #9425. Generated String | ucup-team1004# | AC ✓ | 2281ms | 86356kb | C++14 | 4.3kb | 2024-09-28 19:37:04 | 2024-09-28 19:37:06 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=2e5+5,M=1e7+5,K=1000+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n,q,X[N],op[N];
const int P=1e9+7;
const int bas=137;
ll pw[N],sum[N];
ll qryHa(int l,int r){
return (sum[r]+(P-sum[l-1])*pw[r-l+1])%P;
}
struct str{
vector<int> L,R;
ll len;
vector<ll> siz,sum;
void init(){
siz.resize(L.size());
sum.resize(R.size());
for(int i=0;i<L.size();i++){
siz[i]=(i?siz[i-1]:0)+R[i]-L[i]+1;
sum[i]=((i?sum[i-1]:0)*pw[R[i]-L[i]+1]+qryHa(L[i],R[i]))%P;
}
len=siz.back();
}
ll qry(ll x){
if(!x) return 0;
int i=LB(all(siz),x)-siz.begin();
x-=(i?siz[i-1]:0);
return ((i?sum[i-1]:0)*pw[x]+qryHa(L[i],L[i]+x-1))%P;
}
ll qryS(ll x){
return (qry(x)+(P-qry(x-1))*bas)%P;
}
}A[N],B[N];
char s[N];
void readstr(str &A){
int k;scanf("%d",&k);
A.L.resize(k);A.R.resize(k);
for(int i=0;i<k;i++) scanf("%d%d",&A.L[i],&A.R[i]);
}
void rev(str &A){
swap(A.L,A.R);
for(int &j:A.L) j=2*n+1-j;
for(int &j:A.R) j=2*n+1-j;
reverse(all(A.L));
reverse(all(A.R));
}
ll LCP(str &A,str &B){
ll l=0,r=min(A.len,B.len)+1,mid;
while(l+1<r) mid=l+r>>1,(A.qry(mid)==B.qry(mid)?l:r)=mid;
return l;
}
int b1[N],e1[N],b2[N],e2[N];
void Sort(str *A,int *bg,int *en){
static int id[N],ih;
ih=0;
for(int i=1;i<=q;i++) if(!A[i].L.empty()) id[++ih]=i;
sort(id+1,id+ih+1,[&](int x,int y){
ll len=LCP(A[x],A[y]);
if(len==min(A[x].len,A[y].len)){
if(A[x].len==A[y].len) return op[x]>op[y];
return A[x].len<A[y].len;
}
return A[x].qryS(len+1)<A[y].qryS(len+1);
});
for(int i=1;i<=ih;i++){
bg[id[i]]=i;
int l=i,r=ih+1,mid;
while(l+1<r) mid=l+r>>1,(LCP(A[id[i]],A[id[mid]])==A[id[i]].len?l:r)=mid;
en[id[i]]=l;
}
}
struct ques{int x,l,r,id,w;}Q[N];int qh,ans[N];
namespace bit{
int f[N];
void add(int x,int w){while(x<=q) f[x]+=w,x+=x&-x;}
int qry(int x){int ans=0;while(x) ans+=f[x],x-=x&-x;return ans;}
}
void calc(int l=1,int r=qh){
if(l==r) return;
int m=l+r>>1;calc(l,m);calc(m+1,r);
int R=l;
for(int i=m+1;i<=r;i++){
while(R<=m&&Q[R].x<=Q[i].x){
if(Q[R].id==-1) bit::add(Q[R].l,Q[R].w);
R++;
}
if(~Q[i].id) ans[Q[i].id]+=Q[i].w*(bit::qry(Q[i].r)-bit::qry(Q[i].l-1));
}
while(R>l){
R--;
if(Q[R].id==-1) bit::add(Q[R].l,-Q[R].w);
}
inplace_merge(Q+l,Q+m+1,Q+r+1,[](ques x,ques y){return x.x<y.x;});
}
void Solve(){
scanf("%d%d",&n,&q);
scanf("%s",s+1);
for(int i=1;i<=n;i++) s[2*n-i+1]=s[i];
for(int i=pw[0]=1;i<=2*n;i++) pw[i]=pw[i-1]*bas%P;
for(int i=1;i<=2*n;i++) sum[i]=(sum[i-1]*bas+s[i])%P;
for(int i=1;i<=q;i++){
char c=Gc();
while(c^'+'&&c^'-'&&c^'?') c=Gc();
if(c=='+'){
op[i]=1;
readstr(A[i]);
B[i]=A[i];
rev(B[i]);
A[i].init();
B[i].init();
}else if(c=='-'){
op[i]=2;
scanf("%d",&X[i]);
}else{
op[i]=3;
readstr(A[i]);
readstr(B[i]);
rev(B[i]);
A[i].init();
B[i].init();
}
}
// gdb(LCP(A[1],A[2]));
// return;
Sort(A,b1,e1);Sort(B,b2,e2);
for(int i=1;i<=q;i++){
if(op[i]==1){
Q[++qh]=(ques){b1[i],b2[i],b2[i],-1,1};
}else if(op[i]==2){
Q[++qh]=(ques){b1[X[i]],b2[X[i]],b2[X[i]],-1,-1};
}else{
Q[++qh]=(ques){b1[i]-1,b2[i],e2[i],i,-1};
Q[++qh]=(ques){e1[i],b2[i],e2[i],i,1};
}
}
calc();
for(int i=1;i<=q;i++) if(op[i]==3) printf("%d\n",ans[i]);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 53152kb
input:
8 7 abcaabbc + 3 1 3 2 4 3 8 + 2 1 4 1 8 + 1 2 4 ? 1 5 6 1 7 8 - 3 + 1 2 5 ? 1 2 3 1 5 5
output:
2 1
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 7ms
memory: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 9 0 2 7 10 11 0 9 3 4 5 12 6 10 0 2 21 2 9 1 3 1 2 2 10 22 8 21 4 3 16 3 8 2 12 9 0 2 12 4 5 19 16 7 5 4 4 3 8 5 11 4 6 5 13 0 6 5 1...
result:
ok 33583 lines
Test #7:
score: 0
Accepted
time: 894ms
memory: 77780kb
input:
100000 100000 baabbabaabaaaabbaaababaaabbbbbaabbababbabbbaabbaaabbbbababaababbbbbababaabaaabaaababaabbbbaaababbbbabaabbaaaaaabbbabbbabababababaabbabbbbbaaabababbbaabababbbaaababaabbaaaabbabbaabbababaabbaaaababaabbbbbababbaaabbbaababbaaaaaabbbbabbbbbbabbaabababbbaaaaaabbabbabaaaaaabbbaaaaaabaabaaabab...
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 33381 lines
Test #8:
score: 0
Accepted
time: 978ms
memory: 77788kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
2 2 0 2 1 1 2 2 2 2 0 0 0 0 0 1 0 0 1 0 0 0 2 2 2 0 1 0 0 0 0 1 0 2 3 0 1 0 1 0 0 1 1 2 2 2 1 1 1 0 0 0 2 0 3 0 0 0 0 0 1 2 0 0 1 1 0 0 0 1 1 2 0 2 1 2 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 1 2 2 1 2 4 3 2 0 2 0 0 1 4 0 0 1 1 5 1 0 1 0 0 2 1 0 3 3 1 0 1 1 2 2 3 0 1 3 7 6 0 7 1 1 1 5 2 5 0 2 6 2 2 2 5 ...
result:
ok 33565 lines
Test #9:
score: 0
Accepted
time: 1306ms
memory: 78196kb
input:
100000 100000 aaabbbabbaababbbbbbaaababbbaaaaaabbaaaabababbabababbabbabbbaababbbbabaabaaabbaaabbabababbaaabbabbaaaaabbabababbaaaaababbbbabbabaaabbbaabaabbbaaababbbbbabaaabaaaaabbaabaabbabababbabaaabbbbbbbbaababaabbbabaabbabaaabbbbbababaaabbbbbaaaaaaabbbabbbaabbaabbaaaaaaabbbaabbbaabbaaaababbabaababb...
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 33118 lines
Test #10:
score: 0
Accepted
time: 1544ms
memory: 77360kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 1 0 0 0 2 0 0 0 0 0 0 0 1 0 0 1 0 0 3 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 4 0 1 0 0 0 0 2 0 3 4 4 5 8 7 9 5 0 9 3 8 2 9 0 5 7 1 7 9 0 1 4 1 5 8 5 1 0 0 5 0 4 12 0 9 5 11 10 3 1 8 1 9 2 1 0 5 5 5 0 2 5 1 1 0 0 12 8 11 11 1 4 11 10 3 7 9 9 4 12 11 5 9 6 1 2 8 10 11 4 17 11 6 3 2 4 1 1 3 1 3 2 3 6 5 4 8 12...
result:
ok 33215 lines
Test #11:
score: 0
Accepted
time: 1437ms
memory: 77892kb
input:
100000 100000 mwtmtwnsgaynckkprtjhfnmyzylblnkmrismcyyksqxcikyhrsannbmflvloshydnfvydmuoyphxpjgxsfmyqozidivsigleuvmnyniccdqjekyzjtytudpjbwjmsulfipurvjuxququmkfbrigctewalryoiilmqapofcwpllcwjnzmbtirmfmyhbuqkwqhzidrqbxnulklkjmrnzzclykjoflrbimnshtruucmjiukgvzoekyjnjpkkpwcgrbidyuyodlqaaywfsnbcczuxwsbnrcprq...
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 33475 lines
Test #12:
score: 0
Accepted
time: 501ms
memory: 76120kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 0 1 1 1 1 3 1 3 4 3 3 4 5 7 4 4 4 5 3 4 6 1 0 4 4 12 3 9 9 9 3 7 10 6 9 2 9 4 8 8 7 4 7 7 6 1 5 6 6 4 5 4 3 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 2 0 0 0 0 0 0 0 0 0 0 1 0 1 1 3 1 1 1 4 4 1 0 4 3 2 0 2 1 0 0 0 0 6 5 0 2 4 2 0 0 0 0 1 0 1 0 0 0 2 4 4 1 3 5 1 0 0 0 0 0 0 2 2 2 0 0 0 0 0 0 0 0 2 2 3 1 ...
result:
ok 33689 lines
Test #13:
score: 0
Accepted
time: 712ms
memory: 76704kb
input:
100000 100000 bbbbbaabbbbbaaabaabaaabbbbaabaaabaabbababbaaaaaaaabbababbbbabbababaabbabaabbaaaabbbbabaabbababbbbbbbaaabaabbabbbbbbaaaaababaaabbbabbaabaabaaabbbabbaaabaaaababbaaabaabbabaaaaaaababababbbbaabbaaaabaabbbbaaaababbabbbbabaabbbaaabbbaabaaabbbaaabaabbbbbabbaaabbaabbabbaababbbabbababbabbaabbbb...
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 33438 lines
Test #14:
score: 0
Accepted
time: 258ms
memory: 75228kb
input:
100000 100000 aaabbbbabbaababbabaabbabababaaaaabbababababaabbaaabbbaaaaaabaaabbabbabbbabaabbaabbabbbbbbbaabaaababaaaaabaaaabbbaaaabbaabbaabbbbaaababbabababbaaaaabbbababababaabaabababbabbbbbabbabbbbaaababbbbaabbaaabababaabbbaaabaaaabbabbaabbbaabbbbabbbababbbabaabbaababaaaabbaabaaabbaaabaaaaabbbbbbbab...
output:
0 0 0 0 0 0 0 2 1 4 0 0 1 1 0 0 0 2 0 0 0 8 2 0 2 0 0 0 0 0 0 7 0 0 0 0 10 5 4 4 0 1 4 0 0 2 4 4 0 0 0 6 0 4 0 0 0 7 4 7 3 5 0 0 0 7 0 7 7 0 8 7 3 0 0 11 0 0 4 11 0 2 2 0 11 9 2 11 3 2 12 3 0 13 0 0 3 0 4 5 0 0 0 4 6 0 0 6 0 4 4 0 0 0 5 5 0 0 6 0 7 0 7 8 7 0 6 6 7 7 7 6 17 6 8 7 7 3 15 0 14 6 0 0 14...
result:
ok 33321 lines
Test #15:
score: 0
Accepted
time: 9ms
memory: 55480kb
input:
5 1000 glbdh + 2 2 2 1 2 ? 2 1 2 3 4 1 1 5 ? 1 3 4 3 2 3 4 4 1 5 - 1 ? 1 1 2 2 1 2 1 4 + 1 1 3 + 2 1 4 1 2 ? 2 4 5 1 2 3 2 3 3 4 1 2 ? 2 4 4 1 1 2 3 4 1 3 ? 1 1 2 1 1 3 - 7 + 1 1 5 ? 1 3 3 1 1 2 ? 3 3 4 4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3 7 8 6 4 7 4 3 1 5 ...
result:
ok 49940 lines
Test #17:
score: 0
Accepted
time: 2142ms
memory: 84000kb
input:
100000 100000 dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...
output:
0 6 5 7 5 8 6 6 17 13 14 20 26 23 16 21 20 17 39 26 31 32 46 39 36 52 36 28 28 28 26 29 46 53 48 55 18 43 44 40 49 25 59 42 57 60 42 36 65 50 52 59 25 56 42 42 16 77 43 42 65 57 57 52 44 48 42 19 43 72 65 56 101 69 37 69 73 106 72 55 66 22 70 60 40 73 81 78 60 79 94 63 74 62 74 78 110 76 107 113 108...
result:
ok 9964 lines
Test #18:
score: 0
Accepted
time: 1812ms
memory: 84284kb
input:
100000 100000 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
0 0 1 1 0 0 0 2 2 0 0 1 2 2 0 0 3 3 3 2 0 1 3 0 1 0 2 1 1 1 2 5 4 3 4 3 3 1 3 1 2 1 5 2 3 2 3 5 2 5 3 1 5 3 1 3 1 1 2 4 4 1 5 1 1 2 3 3 3 4 2 5 3 2 2 4 4 2 4 3 3 5 4 7 4 8 6 8 5 4 4 4 6 3 4 7 5 4 9 6 6 5 7 7 5 6 6 5 5 5 6 8 6 5 5 4 7 4 7 4 4 5 4 5 4 8 4 4 5 5 4 8 4 8 8 8 4 7 9 5 7 6 7 6 6 6 8 6 10 6...
result:
ok 90061 lines
Test #19:
score: 0
Accepted
time: 2062ms
memory: 85124kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
0 0 0 0 0 0 0 0 0 0 0 1 0 0 3 0 0 1 0 1 0 0 1 3 2 0 2 3 1 0 2 3 0 0 0 0 3 3 3 0 5 2 0 3 0 1 3 1 0 1 1 0 3 3 3 0 6 3 0 3 0 0 1 3 3 2 3 4 0 1 3 1 3 1 1 6 5 4 8 2 1 3 4 3 0 0 6 8 10 1 4 11 2 4 0 0 0 4 3 9 3 2 10 10 7 3 1 1 3 8 5 0 3 1 8 1 3 0 8 1 6 1 4 1 8 8 6 1 7 0 1 6 9 1 6 4 3 1 2 6 7 1 9 10 3 7 2 2...
result:
ok 49932 lines
Test #20:
score: 0
Accepted
time: 2281ms
memory: 86356kb
input:
100000 100000 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...
output:
1 1 1 0 1 2 2 1 4 4 4 6 6 7 7 9 12 12 11 15 8 21 3 4 8 8 26 11 15 11 20 21 22 29 14 26 25 31 34 26 19 11 29 33 17 20 20 27 33 29 29 43 31 33 33 16 35 30 17 24 40 36 41 19 33 38 51 32 64 28 21 50 42 41 46 29 48 51 62 56 30 45 62 37 54 38 22 43 38 45 43 40 59 53 73 73 72 45 68 27 68 64 62 72 51 65 39 ...
result:
ok 10030 lines
Test #21:
score: 0
Accepted
time: 1835ms
memory: 85128kb
input:
100000 100000 pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp...
output:
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 1 1 2 0 0 0 1 1 1 1 1 0 1 3 1 1 1 2 0 1 2 3 3 0 1 1 1 1 1 1 2 2 2 0 2 3 1 1 1 1 0 1 1 0 2 0 2 0 1 0 2 3 2 1 1 1 1 1 5 3 0 2 2 2 0 2 2 2 1 2 4 5 2 2 5 2 1 2 5 0 2 5 3 5 5 0 2 2 3 0 4 2 4 0 2 1 2 1 2 2 1 0 2 1 3 1 0 2 0 2 2 0 3 3 3 5 2 2 5 3 6 5 3 3 ...
result:
ok 90160 lines
Test #22:
score: 0
Accepted
time: 1107ms
memory: 82328kb
input:
100000 100000 faxyuxswncplvrzynzvlbjqvkdhqfmdddimahxygchjxwqaouebuiijkydypsvhlqeoelcnizmzcnuzvxzqilitcmbrhwjtbastbqyktczoarrihswnbsjtzvkrdjkwzijqkcziwqndcfgyvpepsokrgtlvrwxwjbtctdluemgbpzneomxcqdxxaoxdrgdzrherrygznacprcimyudgbjpelkpxotckckzihjuxnlmkczsutackpunsfnkwvhkadjfnhmvplqfgzmkssoacpuxaipepwro...
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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 ...
result:
ok 49806 lines
Test #23:
score: 0
Accepted
time: 949ms
memory: 83944kb
input:
100000 100000 twdczjujsjrmpsipsunndczjujsjrmpsipsuwynwdczjujsjrmpsipsuwjwdczjujsjrmpsipsuyhtwdczjujsjrmpsipsuwwddczjujsjrmpsipsudczjujsjrmpsipsuybtwdczjujsjrmpsipsuwexdczjujsjrmpsipsuwevtwdczjujsjrmpsipsuwexatwdczjujsjrmpsipsuapwdczjujsjrmpsipsuwepwdczjujsjrmpsipsuwowdczjujsjrmpsipsudczjujsjrmpsipsu...
output:
0 1 0 0 0 1 0 0 1 1 7 0 0 0 0 3 3 0 3 3 1 1 0 0 0 0 0 3 9 13 0 14 5 0 2 10 6 5 2 9 3 9 3 5 6 2 1 0 4 2 1 0 0 10 3 5 2 0 7 0 30 27 0 3 13 0 0 0 1 0 22 0 0 1 0 0 27 0 35 1 0 1 17 0 0 0 1 10 0 0 0 2 2 15 0 52 0 4 14 0 0 36 6 0 25 0 12 0 6 1 0 1 0 0 0 3 9 2 0 60 38 16 15 11 0 0 0 2 13 0 0 6 0 7 0 0 0 25...
result:
ok 9909 lines
Test #24:
score: 0
Accepted
time: 428ms
memory: 83844kb
input:
100000 100000 gqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxicygqxi...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 6 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 9 9 9 10 10 11 11 11 11 11 11 11 11 12 12 12 12 12 12 13 13 13 13 13 13 13 14 14 14 15 15 15 15 15 1...
result:
ok 90066 lines
Test #25:
score: 0
Accepted
time: 1035ms
memory: 84516kb
input:
100000 100000 nbaiostoyrvtrkngnuatnddlyjzqnfgufkqtmahrkmxxstxnqszjxibrnymsyujvzvazdmernpfoapfefjnbberzsmfmfqjwyyrqmbgdzppkratnddlyjzqnfgufkqtmahrkmxxstxnqszjxibrnymsyujvzvazdmernpfoapfefjnbberzsmfmfqjwyyrqvazynjzqnfgufkqtmahrkmxxstxnqszjxibrnymsyujvzvazdmernpfoapfefjnbberzsjzqnfgufkqtmahrkmxxstxnqsz...
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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 50106 lines
Test #26:
score: 0
Accepted
time: 676ms
memory: 86304kb
input:
100000 100000 avrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpogavrzpo...
output:
2 2 13 28 31 64 83 95 108 119 121 127 134 141 157 158 162 164 175 181 181 195 201 201 209 210 215 218 253 259 263 263 273 274 280 303 310 317 318 325 328 342 360 368 376 392 393 420 427 431 434 440 456 457 485 501 502 533 556 593 601 601 605 606 614 617 644 654 687 700 721 723 728 728 731 731 738 74...
result:
ok 9852 lines
Test #27:
score: 0
Accepted
time: 666ms
memory: 84204kb
input:
100000 100000 nzqcglfwczqmzqcglfwczazqcglfwczzmzqcglfwczzqcglfwczpmzqcglfwczzqcglfwcxmzqcglfwcznzqcglfwczqcglfwcmzqcglfwczmzqcglfwcjmzqcglfwczzqcglfwczrzqcglfwczqcglfwczqcglfwczmzqcglfwczwzqcglfwczqcglfwcjzqcglfwcmzqcglfwcmzqcglfwczzqcglfwcizqcglfwcomzqcglfwcmzqcglfwczzqcglfwcjmzqcglfwczmzqcglfwczmz...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 2 0 1 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 3 0 0 0 0 0 0 0 1 2 0 0 0 0 1 0 1 0 1 0 0 ...
result:
ok 90005 lines
Test #28:
score: 0
Accepted
time: 2091ms
memory: 84960kb
input:
100000 100000 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
5379 21600 8676 17796 6561 7062 8794 24490 12428 13642 26349 12930 17230 4054 29012 19503 23951 2084 14612 6542 11110 18521 5532 30725 21338 30107 893 12051 20828 7845 32580 8063 4190 21112 8005 33480 15470 3466 1311 10240 13981 29868 3358 35905 19687 9180 46665 11173 4030 5610 14002 22315 28887 629...
result:
ok 49879 lines
Extra Test:
score: 0
Extra Test Passed