QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#378255#8576. Symphony in c++ majorucup-team2894#AC ✓373ms135152kbC++203.2kb2024-04-06 10:27:352024-04-06 10:27:35

Judging History

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

  • [2024-04-06 10:27:35]
  • 评测
  • 测评结果:AC
  • 用时:373ms
  • 内存:135152kb
  • [2024-04-06 10:27:35]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;
using pii = pair<int,int>;
using ll = long long;
using pll = pair<ll,ll>;
using vi = vector<int>;
 
using ld = long double;
 
#define all(x) (x).begin(), (x).end()
 
const int maxn = 1e6+10, inf = 1e9+100;
const ll linf = 1e18+100;
const int mod = 998244353;
 
const ld eps = 1e-9;
const ld PI = acos(-1.L);

using Matrix = array<array<int,8>,8>;
using Vector = array<int,8>;

string tar[8] = {"", "do", "re", "mi", "fa", "so", "la", "ti"};

Matrix mval[26];
Matrix getmat(char c) {
  Matrix m;
  for(int i=0;i<8;i++)for(int j=0;j<8;j++)m[i][j] = -inf;
  for(int i=0;i<8;i++)m[i][i] = 0;
  for(int i=1;i<8;i++){
    if(tar[i][0] == c) m[i][0] = 1;
    if(tar[i][1] == c) m[0][i] = 1;
  }
  return m;
}

Matrix mult(const Matrix& a, const Matrix& b) {
  Matrix c;
  for(int i=0;i<8;i++)for(int j=0;j<8;j++)c[i][j] = -inf;
  for(int i=0;i<8;i++)for(int j=0;j<8;j++)for(int k=0;k<8;k++){
    c[i][k]=max(c[i][k],a[i][j]+b[j][k]);
  }
  return c;
}

Vector mult(const Matrix& a, const Vector& b) {
  Vector c;
  for(int i=0;i<8;i++)c[i] = -inf;
  for(int i=0;i<8;i++)for(int j=0;j<8;j++){
    c[i]=max(c[i],a[i][j]+b[j]);
  }
  return c;
}

const int maxnodes = (1 << 19) + 100;
Matrix seg[maxnodes];

string s;

const int thres = 2;

void init(int x,int l,int r) {
  if(r-l<thres) {
    seg[x] = mval[s[l]-'a'];
    for(int i=l+1;i<=r;i++)seg[x]=mult(mval[s[i]-'a'],seg[x]);
  }
  else {
    int mid = (l+r)/2;
    init(x*2,l,mid);
    init(x*2+1,mid+1,r);
    seg[x] = mult(seg[x*2+1],seg[x*2]);
  }
}

void upd(int x,int l,int r,int a, char c) {
  if(r-l<thres) {
    s[a]=c;
    seg[x] = mval[s[l]-'a'];
    for(int i=l+1;i<=r;i++)seg[x]=mult(mval[s[i]-'a'],seg[x]);
  }
  else {
    int mid = (l+r)/2;
    if(a<=mid)upd(x*2,l,mid,a,c);
    else upd(x*2+1,mid+1,r,a,c);
    seg[x] = mult(seg[x*2+1],seg[x*2]);
  }
}

Vector ans;
void qu(int x,int l,int r,int a,int b) {
  if(l==a&&r==b) {
    ans = mult(seg[x], ans);
  }
  else if(r-l<thres) {
    for(int i=a;i<=b;i++){
      ans = mult(mval[s[i]-'a'], ans);
    }
  }
  else {
    int mid = (l+r)/2;
    if(b<=mid)qu(x*2,l,mid,a,b);
    else if(a>mid)qu(x*2+1,mid+1,r,a,b);
    else {
      qu(x*2,l,mid,a,mid);
      qu(x*2+1,mid+1,r,mid+1,b);
    }
  }
}

void solve(){
  int n,q;
  cin >> n >> q;
  cin >> s;
  for(int i=0;i<26;i++){
    mval[i] = getmat('a'+i);
  }
  init(1,0,n-1);
  for(int i=0;i<q;i++){
    string ty;
    cin >> ty;
    if(ty == "?") {
      int a,b;
      cin >> a >> b;
      a--,b--;
      ans[0] = 0;
      for(int i=1;i<8;i++)ans[i] = -inf;
      qu(1,0,n-1,a,b);
      cout << (b-a+1) - ans[0] << "\n";
    }
    else {
      int a,b;
      string t;
      cin >> a >> b >> t;
      // cerr << a << " " << b << " " << t << endl;
      a--,b--;
      for(int i=0;i<t.size();i++){
        // cerr << a << " " << t[a+i] << endl;
        upd(1,0,n-1,a+i,t[i]);
      }
    }
  }
}
 
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout<<fixed;
  cout.precision(20);
  cerr << fixed;
  cerr.precision(5);
  solve();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3796kb

input:

8 10
eldorado
? 1 3
? 1 8
# 6 7 it
? 1 8
# 3 3 t
? 1 8
# 1 8 streamer
? 1 8
# 1 8 symphony
? 1 8

output:

3
4
6
6
6
6

result:

ok 6 numbers

Test #2:

score: 0
Accepted
time: 357ms
memory: 134836kb

input:

500000 300000
rfsraltzititrofomloldlaefikdemaddaafmimiioiuaueiaedifacmxamttiiitaaltiiireexeafsaaraedosotlaioootaiosizlifiioadhnxiofsasaflleaiisstaotdlliulilxatrpdaraaraaoiaeoooiumwuumarlifesroloistedoaaieolisaoatamsredorrfiifaaidfeassfioaiasmstomasallsftsrfaiiirteomaeiirefldmlaoaofrxlaeuilioirafotoa...

output:

122151
133262
96922
55212
91547
148150
73505
4097
300798
54037
56741
265921
127608
170707
79236
209443
84732
83219
184042
77169
94062
172946
202750
97798
92449
67243
171524
145772
53856
165837
104913
179165
35068
55893
17287
74510
319355
244761
118810
162815
175172
136079
43107
237581
112894
48610
1...

result:

ok 259513 numbers

Test #3:

score: 0
Accepted
time: 352ms
memory: 134792kb

input:

500000 300000
lotlidiecoletemimaaoaieraollaootuletelsaoasaooouafffomoiiadlaaoialmiaohrteruirstasoiroeoiadeaitimliimlaoiuaeslfosyfisiiimooottmfamirdoliaalmmeimmiodaouafyomaadoioroafeeuerommodsdleiofatiumuaososoeeldemimoeealoifioaooieiolloiqltfeacsmstjliliteddvdtiooeltaaddorieeatdriseotiooaooffmaldtti...

output:

47592
52818
241877
176764
27498
150113
14836
51092
9558
225258
201572
264107
109170
71964
84756
115631
110279
135193
106534
133703
185514
74911
95984
4681
69107
147124
166099
99175
108179
28042
208879
175112
16110
59221
84912
152966
78464
112642
31867
10884
116218
225278
141566
269148
65227
17079
18...

result:

ok 252049 numbers

Test #4:

score: 0
Accepted
time: 351ms
memory: 134812kb

input:

500000 300000
iaeoeoieoeaioaeeoeeooeeiiaiiodaeikaaaaoiiaioieioaiaoiaiaoaafaeoeeeaeiieieaaoaaaooeoaiooiaeaiieooiooeiioeieaoeaieieaeieeiaaaieiooeoaiaeeeooiaaeoeaioaaeeoeaeoaieeeeoiaiaaoeoeaoaeaoaaaieaieaaiaaieoioiiioaiiioooiaaeaoioeiaeiieioeeaiiaoeoaeoaeeaeaooiaeoeeeaeeieeeoaieeioeeeieboeiooieooeaiaai...

output:

155664
273837
139845
16745
209259
88451
160434
169710
329924
215057
243772
4084
207120
80591
7576
371931
44628
68519
237892
115478
13174
263235
81210
25739
190523
95252
265302
287547
272144
65242
68551
417351
256956
67992
134544
58333
37243
335458
229829
258731
259804
111703
163824
818
334444
154340...

result:

ok 259639 numbers

Test #5:

score: 0
Accepted
time: 370ms
memory: 134836kb

input:

500000 300000
mfldmtsdrrrdsmdsmssmddtsfstsfssrlmlrmslorsdtfffmlffflrftddfrttrtelftdtrsrstsrmddseftlmrrtfmlfmmrfdrsmmmtstmfdtmddlmlrldsfdmfstrfifrmtmsmtllrfstmdlttldfllfsmtdrlfrrfffdrmtsforddrtssldmsmslffftssrdlcdmrdrrlmlfrlmrffddmrddrsmdtrltmdrmdltmsssltttdsfdsdtrmmdrtmrstorrffmrftfssmsdmllltrrsflrf...

output:

170615
247842
73399
454147
266865
54003
27279
65510
174723
184626
159949
23029
203052
169738
278963
82792
346300
15256
9231
33253
39362
189106
58738
24996
20987
158695
116975
45334
178698
213764
214955
31665
21659
24427
125495
59410
275000
63449
113696
57040
388491
419930
333741
370485
149329
163203...

result:

ok 259629 numbers

Test #6:

score: 0
Accepted
time: 356ms
memory: 134832kb

input:

500000 300000
czpyuxvyjqnxxgvjkgcucuqhwovqgubbkwvwwnvgcybzzuqbgxvzxqvqbnkzguwcncnyzxxkunchbnubbvbqyxzwbwvgunbbvgppkbzgjwyhqhlhpxqvbwxywhbxnkyxuhvhgckuvkyyqkghhkqgzjpnpuwqwpbxkbjqcycyqvgukpjqcwbbucwwbuzqywqwbzpufxcwqyqpgnqycbhqwxpyhjjpbyuhkugunywzpxwjvxjnpkyqyukycuhbqcbvvgjbcxqpzbhwpxvpgkzvkbcxywqzuc...

output:

252806
247101
133249
312511
114341
73663
40589
19639
408077
146060
263530
16361
112488
256479
43210
14991
39252
125475
173653
413028
52929
298538
119913
49669
170516
178708
96160
69247
191681
442952
185294
368877
36983
97493
303846
160379
368975
160873
237029
166745
270367
43050
63804
130632
215542
...

result:

ok 259840 numbers

Test #7:

score: 0
Accepted
time: 345ms
memory: 134820kb

input:

500000 300000
amsdoiofrraaioimifstsiyiimreorktolsiiiduofiatidlldliaoifmfdaeaesopeuriilaoafooefulietmoadrafoidsmalrlaeiftfmoaddrsflsntmisiaitmiftdearlsifsdmfmfomiriaoilidoaeftieoaietlomftqeioleoaoieemddltiifwaroaosidoomoismslaamrmemesftomiaomofdkaisitariidmsiielatmdaaigdrmomiagomyitoaafodsralotoorefa...

output:

223011
244099
31549
75130
154921
44925
209959
101993
282634
127723
99737
50446
81230
116844
78698
97497
110433
80488
165468
22675
262802
157063
219488
127253
147503
59704
53826
293093
288620
61987
45835
155711
23954
242875
247121
234463
49947
255051
119167
284400
306083
256546
155392
242605
4545
211...

result:

ok 299993 numbers

Test #8:

score: 0
Accepted
time: 368ms
memory: 135152kb

input:

500000 300000
sframtdrsmoosriamldrfmommrilliarsimrratmaersltllitseadkdasoeirreiaaoaiesesaooaoaoddsooioioalftseadifaeotmfddaarassldotaoftldsdrsoitaoaioapilfarsrftivtsrhxlirmlytrdswmiismrfctmaormiooolilafdlforraaisftttellmasiloimrserotianslotmooevfiaoafdaraotisoirodomaerrmftaidaaafatoaaomimfoiaoloeaal...

output:

277612
157353
76818
252490
143568
48930
33261
264593
13910
29655
244387
33023
251154
39474
140414
77265
204309
130191
165359
176962
25055
142229
291636
211276
33126
114028
129436
212380
65758
179755
124526
93940
163685
50456
246610
198842
17334
131827
246450
44098
192458
109098
182124
20026
217819
6...

result:

ok 299999 numbers

Test #9:

score: 0
Accepted
time: 351ms
memory: 135000kb

input:

500000 300000
lidrfmeollmalmateadqdrrsaiiatrtkfatizloiltadstioliodatmolitddhtdomeptmsdutfdmomidddiaoidffuduosamitpahtdtoatufetreusifaaooeoeimmosqotrlwoshifgmipmiidmolelolrtofsaoesosldiqottttiiliaemduaasroaoasoulrmoreoaoisortrtaemsfofdwemdmedomuoiailriefaaaafodattaiioirojmeoddllarafmmoooeoofamrtlamme...

output:

212627
202392
40965
224537
105052
120592
81309
15317
105849
63739
8050
291407
45986
30855
309763
24189
159753
260330
127439
103266
6917
110772
1159
38820
185923
242493
38951
285915
284575
161444
18645
309458
69738
29644
18295
223147
237826
26737
5043
113381
206203
99711
138427
251950
96951
183255
22...

result:

ok 299944 numbers

Test #10:

score: 0
Accepted
time: 350ms
memory: 134828kb

input:

500000 300000
erdfmdisfrzffroemadsaottfeafdlauoermooavdoodeeiiteoaioiiralliemrslzoolmltlrfkaogianmmmrnmiiaofffototidldasddizoetefiliouisiuuidadftilolosorrlmlimtosarrladsimferaedfamlsdfsaifiselaaflroioarsaflddoonraaadimooimeduxsrlolleroofoofmoiryeloodliadarmsalolmdsoafsyylaamiertiddmaoafosidisrlmduia...

output:

15259
113288
220815
156954
15618
135903
73729
226050
39490
83872
82620
86957
112601
237050
146383
24396
75918
144053
43114
22165
75762
63909
272997
147524
217444
246685
263575
38186
141439
20563
84462
149039
42269
293780
209140
101970
82278
180171
82978
70885
15375
778
42561
255474
61255
3176
64952
...

result:

ok 200000 numbers

Test #11:

score: 0
Accepted
time: 289ms
memory: 134992kb

input:

500000 300000
mflloooseefaerivbotdidflomeisustcfdtpiloftsefriielodriorsrfnrmillafifaaalarlsuioieeasimotattoaeailstftoraileolfotpmdiataeolllertatdrieaieogwmeiolaemmaoeffmmsaatjoaiosodmiorrrieatdweoslteitslrjfsuefitfiohloddirmoalobsijlditdsaieasdaimodxaaollrlrtoeeorolaaufemetiaiooatsjrssldlltaoifrorrf...

output:

99460
218290
231216
180988
30522
126828
110853
38646
74849
80785
74248
88213
85124
201026
302285
41464
59126
113774
190335
130258
81671
45547
227442
619
91975
134533
78487
156408
56126
222735
210419
166366
51590
98393
132917
155557
246994
181489
45646
6303
28675
173945
57398
180910
18358
79758
21519...

result:

ok 300000 numbers

Test #12:

score: 0
Accepted
time: 44ms
memory: 4300kb

input:

1111 34567
tstfaoolatsrooauaiaralairoaltzossigaieliaatooifureiildiessasdlsuiodatqtosdxioididesotarlotrilmsrmimoitfoaaurrmlseooiiimamrylldtidifoirsnofoffiaitalwetmriolfpudildafoaottoosfaatiieuaforregimiflmuaaeaffajifiafotiremoalsdnoraafdmmobfitfojztiaaedeaseldamoomdiedmeaiipsaoedadameltdamartfolmitoa...

output:

40
415
149
290
247
101
692
79
327
188
10
338
542
445
28
139
776
107
121
556
265
562
404
97
547
152
237
43
48
298
451
122
207
251
206
121
330
227
239
222
49
182
330
13
69
207
287
75
229
128
334
171
123
448
441
230
370
61
98
90
672
126
105
269
212
492
175
90
84
101
497
163
69
683
74
424
99
720
767
66
...

result:

ok 33778 numbers

Test #13:

score: 0
Accepted
time: 39ms
memory: 3572kb

input:

1 300000
a
? 1 1
? 1 1
# 1 1 f
# 1 1 m
# 1 1 d
# 1 1 i
? 1 1
? 1 1
? 1 1
# 1 1 o
? 1 1
# 1 1 h
# 1 1 k
? 1 1
? 1 1
# 1 1 m
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
# 1 1 t
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
# 1 1 o
# 1 1 o
? 1 1
? 1 1
# 1 1 q
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
? 1 1
# 1 1 e
? 1 1
? 1 1...

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
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
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
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
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
1
1
1
1
1
...

result:

ok 200000 numbers

Test #14:

score: 0
Accepted
time: 362ms
memory: 134812kb

input:

500000 300000
rdiofommsddakrssmoariffilsiriojaefsarmoiitaiimfreoefimaoahdeoyimmmdstsoaiamltddsdfeoftmsfonifdisimioiidslsfftmumteafruawttdafaeaftstiaofiommrellaaedmlmtmtteadotealafudridlfommofaudoffaaloioaeematsaeooatrsouriloouarsaoolioolfiltltaomatefsftmatdodiroaosllpairoiedutsoiromoadoaailddsediise...

output:

107445
56695
9508
436678
167563
57050
45340
336836
49756
46022
208532
342287
201758
147717
340761
147084
72089
138991
144987
282751
117034
32815
12074
43871
313224
96260
193586
40864
36782
384372
234195
46566
59268
111126
246182
133291
192469
60292
356101
121971
183236
165437
165429
275547
121850
28...

result:

ok 240866 numbers

Test #15:

score: 0
Accepted
time: 373ms
memory: 134820kb

input:

500000 300000
jsedovfebimtdftrrtuedfogoeitedafieleooarrmmlllioroiaalsmomeakmtetaiaolmoeamaassoulorfdiaoasimuataoafeaiirairmssztrfsdealoamsirocdfvdrlirttdaalaioafssodlasoofririmifomsososlatiaaadsilaolflaaadrosnfloiimgeismaaotaefidodtodriweuddqiaaiiiedoosotaosarasmeeddassfoisifjieauofoitieslfallldrdba...

output:

330282
168449
13569
338375
325937
50402
104854
32708
202237
396258
60067
300525
41449
52434
233908
50973
195732
165034
18127
39012
50887
205160
221001
244939
263621
241413
296881
54180
74555
317038
73556
203505
141393
17774
339668
140510
15386
134493
328432
97274
113704
7889
205383
52404
21590
35329...

result:

ok 240899 numbers

Test #16:

score: 0
Accepted
time: 346ms
memory: 134760kb

input:

500000 300000
laladomidofatiresomidofalamilafasomidolamidodosododofalatisosorefamitifalalaremimimimifaresotifaretifalareredomidolamimimirereredododofarerelamifamimisomilatilatidoreladoremitilatidotiremidodomlareltilasotifasomidorerefafadotilamilamirelatitiretifamiremiredomitidotisodomidodofarerelaso...

output:

3389
1454
1121
1818
4888
3291
7497
253
1247
112
1548
6499
2144
2052
2637
4753
2079
4395
4465
861
316
3436
3120
3755
5465
6243
1792
2187
3941
2588
6866
1437
3139
1221
2590
2415
285
931
5442
4917
977
7499
3351
3235
2496
7498
7498
3013
4631
5080
1251
3844
1832
575
2644
138
7498
4181
4462
935
4214
3149
...

result:

ok 279358 numbers

Test #17:

score: 0
Accepted
time: 334ms
memory: 134772kb

input:

500000 300000
fasofasotisomisodofasofalaladotisoreretisoreretirerefaretifafamimimitifarelaresodosofalafarefaretisotidofamimidomimifadoreretititimidolaretisofalarerefasoladotisosolafasodomisotirefamititifareresomilalamifamitilaresodotimilafafafalafalamimitiladolafaredofalamiredosodotilalafamidotilala...

output:

2
1
1
1
1
0
0
0
1
0
1
1
1
1
2
0
1
1
0
1
2
0
2
1
1
2
2
1
1
2
1
0
1
0
1
1
2
1
1
1
2
1
1
0
2
1
2
0
2
1
0
2
1
1
2
1
1
1
2
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
0
1
2
0
1
1
1
2
0
0
2
2
1
0
2
1
1
0
0
2
0
1
1
1
1
1
2
0
1
1
1
1
1
0
1
1
1
1
0
1
0
0
0
1
0
0
0
2
2
1
1
1
1
1
0
0
0
4
2
1
4
4
3
2
0
1
2
2
4
4
4
2
...

result:

ok 279255 numbers

Test #18:

score: 0
Accepted
time: 353ms
memory: 134812kb

input:

500000 300000
toffqmtaalridseeosdsomfissetamrimfariudtaotartiasaresyootrositdeodtoieflodlmtaifoefrvoaeriofmvhlusiaetrdpraudfiaoxltatomoifaaiimltdoaidsutoidafmsdiermdsseaaolmioivoleiuftifafamsomiaereomtmmdaloeomaiaaeoaaileoileoauiamoaaoaiosloadoodvaaaeatmzoimoemooousfzmdfaioadoomafafemtaartotwqrfrooi...

output:

50265
249907
163436
35665
32182
125412
70410
180463
218497
307638
59680
139099
38809
58628
51525
212099
191059
57636
169366
189774
289029
241934
2542
164485
231054
200643
131945
61048
17783
44344
3550
106392
45754
17739
165037
114385
286743
198970
19631
31360
137660
220094
45434
2235
265659
35406
93...

result:

ok 299659 numbers

Test #19:

score: 0
Accepted
time: 354ms
memory: 134772kb

input:

500000 300000
foatiflyrroieesofektoftialirfautttliuiareoimirfiitaipematordofemirmadiriadforirtseoeeaetifrraaieoimdodaofitammoeofsiosleaoolqdrasarxdoiairilflmaomqrorroeatotiomlvduomsiarismoiiirroafcaeummgolmaatdulaeaddeoaaiolidaalrijloiaasafsartomifidzoeriiroifdadiaileofossdtitaaimoaidatopdorfmsesaos...

output:

217970
95973
296783
60569
36651
211367
151055
192059
307891
19485
26927
66091
1215
96877
91016
102186
123972
214828
101478
56922
100045
228321
131041
98247
176614
31216
97675
53159
99698
233116
82387
151956
117010
21225
90315
6806
242501
127916
1359
90652
56798
7520
15474
3004
31416
222305
155349
21...

result:

ok 295560 numbers

Test #20:

score: 0
Accepted
time: 349ms
memory: 134816kb

input:

500000 300000
rtwldlrmjrmhedeesdoaditimoifaedooiteirfiiloaireuaottiiimlaoifdoatimoidiieaefmtaiadartasiiyoielldaaedoaaaoaeeiioifodhumosoeuoarloofuilfataafoiaoamfrodmslefiroadaaerfomorsloiafeianrdouhwosunrelooiddfrdoealailoliuliosomaoraiadafdoolraleslsirdhoeldaiousalfimiioedaeuotraloiotdssfaasolreoios...

output:

243572
13005
111931
12857
184787
73243
47721
201161
290056
49440
84147
80816
35579
84056
249519
188744
9712
156987
98535
112603
38000
295461
14465
102795
126939
123271
70805
184935
5460
64593
140560
323734
37755
49689
48096
145255
133926
87859
311047
203024
125978
131880
207021
65357
246126
124424
1...

result:

ok 297954 numbers

Test #21:

score: 0
Accepted
time: 359ms
memory: 135044kb

input:

500000 300000
mzeoioaoasoetliteiezasfomafdpmasadsaeaimtildiefzfapmdooearoaaaelrtlilsblrmeaoaotyaloamietderoaaasoimtosiriduotedoootelassssyiolefiioiusofsicrtsdadatroarffsiloslfaedildloioiedrujtiiloatoamommdriiimsaroliaolfrtrtiasfsdtidimlfdroeioiosiaudaardrolaoorlmeiesdrosrtitfoilioaaanlaoiidadrlidmio...

output:

120759
277797
27702
271170
55527
322243
323178
226326
289472
7001
169628
193048
144912
98537
38434
89506
33706
10424
175366
167538
340437
235829
380294
64479
150998
129216
85266
387531
336736
213188
205642
370177
339035
63216
304718
34139
153626
82026
210428
111707
67518
41150
164063
56946
267996
17...

result:

ok 240912 numbers

Test #22:

score: 0
Accepted
time: 192ms
memory: 8280kb

input:

9977 300000
muvfaooooosfasttoroeoieedriddomsfofgtratsmermrloaomrorfmrdftmmiristftclidtiifyofautsloeaafileridomeltefteameoifafioitifoiiioqalooidilauooasmmsmiefoerarlfcostraloalotiixlorisofttioomcsofiilrolfaddfiitiadidmmroeiroieaofftfaifowdmladtuaioooitolaodmtmoifdfodrfslraouiofltsooomiomiftsfriiiosia...

output:

910
4559
3662
815
1083
4636
265
2320
243
834
1428
718
464
1961
2607
2817
1886
1493
370
255
2049
1007
1086
1256
86
698
6255
3096
3264
324
62
773
576
1769
3902
128
703
1204
2340
807
4021
2492
649
2532
2778
2446
1071
2090
349
2782
1422
5003
3242
2034
4291
1089
98
64
3853
1043
406
6962
3824
1854
2860
19...

result:

ok 299980 numbers

Extra Test:

score: 0
Extra Test Passed