QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#53219#4808. Great PartyranyaAC ✓105ms14632kbC++141.2kb2022-10-04 20:19:092022-10-04 20:19:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-04 20:19:13]
  • 评测
  • 测评结果:AC
  • 用时:105ms
  • 内存:14632kb
  • [2022-10-04 20:19:09]
  • 提交

answer

#include <bits/stdc++.h>
	
using namespace std;

int read() {
	char c = getchar();
	int v = 0;
	
	while (c < '0') {
		c = getchar();
	}
	
	while (c >= '0') {
		v = v * 10 + c - 48;
		c = getchar();
	}
	
	return v;
}

const int N = 1e5 + 3, V = (1 << 20) + 3;

int n, m, k;
int num[2][V], a[N], bl[N];
long long now, ans[N];

struct node {
	int l, r, id;
} q[N];

int cmp(node x, node y) {
	if (bl[x.l] ^ bl[y.l]) return bl[x.l] < bl[y.l];
	return bl[x.l] & 1 ? x.r < y.r : x.r > y.r;
}

signed main() {		
	n = read(), m = read();
	k = n / sqrt(m);
	for (int i = 1; i <= n; i++) {
		a[i] = a[i - 1] ^ (read() - 1);
		bl[i] = (i - 1) / k + 1;
	}
	
	for (int i = 1; i <= m; i++) {
		q[i].l = read() - 1, q[i].r = read();
		q[i].id = i;
	}
	
	sort(q + 1, q + 1 + m, cmp);
	
	int l = 1, r = 0;
	
	for (int i = 1; i <= m; i++) {
		int ql = q[i].l, qr = q[i].r;
		while (l < ql) now -= --num[l & 1][a[l]], l++;
		while (l > ql) l--, now += num[l & 1][a[l]]++;;
		while (r < qr) r++, now += num[r & 1][a[r]]++;
		while (r > qr) now -= --num[r & 1][a[r]], r--;
		ans[q[i].id] = 1ll * (qr - ql + 1) * (qr - ql) / 2 - now;
	}
	
	for (int i = 1; i <= m; i++) {
		printf("%lld\n", ans[i]);
	}
	
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3680kb

input:

4 5
1 2 2 4
1 2
2 3
3 4
1 3
2 4

output:

3
2
3
5
5

result:

ok 5 number(s): "3 2 3 5 5"

Test #2:

score: 0
Accepted
time: 2ms
memory: 3768kb

input:

4 5
5 6 7 8
1 2
2 3
3 4
1 3
2 4

output:

3
3
3
6
6

result:

ok 5 number(s): "3 3 3 6 6"

Test #3:

score: 0
Accepted
time: 2ms
memory: 3668kb

input:

10 10
3 7 3 1 6 6 10 3 3 3
9 10
5 10
3 7
5 6
5 6
9 10
3 10
1 4
6 6
1 4

output:

2
18
14
2
2
2
33
10
1
10

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

10 8
91 63 1 34 50 11 10 73 96 67
5 9
2 7
2 5
4 7
1 10
3 3
1 4
5 10

output:

15
21
10
10
55
1
10
21

result:

ok 8 numbers

Test #5:

score: 0
Accepted
time: 2ms
memory: 3784kb

input:

10 6
9 539 285 408 615 861 951 413 319 368
4 4
8 10
1 7
3 9
2 3
2 10

output:

1
6
28
28
3
45

result:

ok 6 numbers

Test #6:

score: 0
Accepted
time: 2ms
memory: 3764kb

input:

10 6
1348 7002 4687 6325 8253 5750 2464 5509 6543 8704
3 9
4 8
8 8
8 9
2 9
9 10

output:

28
15
1
3
36
3

result:

ok 6 numbers

Test #7:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

10 8
59041 28802 92255 14246 65768 79252 70656 81265 98363 85237
1 6
9 10
4 7
6 8
9 10
1 2
1 3
4 5

output:

21
3
10
6
3
3
6
3

result:

ok 8 numbers

Test #8:

score: 0
Accepted
time: 2ms
memory: 3804kb

input:

10 7
28607 249948 373828 584253 989446 308313 199311 253174 283937 133758
2 4
1 2
4 9
7 8
7 8
2 6
1 1

output:

6
3
21
3
3
15
1

result:

ok 7 numbers

Test #9:

score: 0
Accepted
time: 2ms
memory: 3716kb

input:

100 98
6 9 6 10 8 10 3 4 7 5 4 10 2 10 4 5 2 1 7 1 3 1 4 1 1 2 6 9 3 10 2 5 3 2 6 2 1 7 7 6 5 4 2 5 3 2 7 2 6 2 9 7 10 7 4 2 9 3 3 7 9 1 4 9 6 1 5 5 8 3 7 5 8 3 9 5 8 7 8 6 6 3 2 3 8 1 8 1 5 9 1 8 6 3 3 7 10 6 5 5
48 72
14 46
23 28
37 84
1 65
45 72
9 19
9 81
37 53
47 50
25 26
26 88
51 54
53 69
22 94...

output:

316
534
20
1144
2054
394
64
2596
149
10
3
1944
10
148
2598
35
169
6
28
318
605
2964
366
4571
2815
130
1220
52
160
2964
129
3040
793
1491
89
1932
227
64
77
420
332
646
267
1081
902
956
2668
2191
449
149
223
5
3763
1312
102
1221
578
2188
289
681
367
960
1
226
151
720
116
101
3348
905
132
1
88
1140
199...

result:

ok 98 numbers

Test #10:

score: 0
Accepted
time: 2ms
memory: 3736kb

input:

100 96
78 64 64 32 42 65 94 54 35 27 83 6 6 90 86 45 93 72 56 80 5 31 91 87 56 10 100 79 53 69 98 93 79 28 89 5 14 4 12 100 50 98 99 6 29 38 85 37 34 85 15 76 73 7 91 93 28 10 74 23 96 77 27 84 21 79 62 69 14 81 18 93 1 23 11 1 13 72 8 91 11 45 50 67 21 42 55 44 95 57 4 85 17 96 84 46 22 56 19 58
1 ...

output:

2761
1029
4167
3989
28
90
626
625
2614
494
942
626
253
2200
171
3389
250
4539
251
941
558
55
3308
251
1372
349
55
662
2688
737
378
66
699
136
2335
44
90
151
856
626
1270
45
1121
815
406
1477
77
228
525
1760
45
210
629
2070
66
1760
9
463
15
1220
557
591
190
699
463
28
816
1076
118
44
492
44
1942
2616...

result:

ok 96 numbers

Test #11:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

100 98
354 899 868 821 878 486 413 896 872 129 97 801 838 279 971 756 250 24 245 883 731 887 106 204 381 204 678 33 340 987 80 662 845 955 39 654 989 24 105 822 704 690 573 800 243 372 939 338 986 246 983 445 196 931 290 150 610 635 809 496 779 722 596 920 67 16 391 728 575 975 469 413 82 768 680 43...

output:

21
741
21
253
1275
325
465
703
3
276
105
495
465
3
136
1224
1652
1
66
780
253
1225
2484
55
1484
120
528
1175
1484
45
300
496
1378
3239
465
1
190
630
2850
1830
1952
325
3
1
36
1325
153
435
231
1225
406
6
153
465
28
105
351
666
1769
253
2211
1891
819
406
2345
496
1830
21
528
300
2628
10
2016
6
1710
10...

result:

ok 98 numbers

Test #12:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

100 98
4940 7560 6878 1066 6510 7648 7900 5423 1384 5142 6451 2335 6486 5411 5312 3059 1974 7844 4678 9963 926 8585 6379 1352 179 919 4870 3315 1907 8327 519 9396 1628 9268 7695 9932 9154 1056 2772 3916 4397 5712 5614 7771 2968 6540 6205 2692 6900 3920 6688 2278 7843 7293 8751 5538 2638 6424 5234 27...

output:

861
351
528
2415
21
1176
2278
78
3
45
465
903
55
1035
45
171
190
120
2145
105
3
465
28
703
3570
210
66
3081
861
561
15
1081
2145
3
3
91
378
210
15
630
1596
666
990
703
66
55
45
820
55
1431
465
4186
78
276
153
136
3
231
2556
861
666
1540
300
15
15
325
2016
1128
2415
105
2850
496
55
55
1225
1770
780
2...

result:

ok 98 numbers

Test #13:

score: 0
Accepted
time: 2ms
memory: 3940kb

input:

100 98
79873 84742 75872 96693 10191 985 31311 53705 98909 81177 17919 79656 53853 81691 50226 50507 73858 61819 29518 85453 34982 53653 93823 31917 3269 21003 95730 52976 65728 25570 21628 88764 20155 36740 90961 65470 511 72479 12397 89701 31897 5413 84398 51940 52729 43338 40696 80980 67508 12297...

output:

2850
276
210
91
1891
1081
3
2485
946
2850
10
136
465
28
136
36
3741
496
1176
55
1378
45
45
465
105
2485
3
741
465
1596
1225
136
1891
1225
1378
231
351
3081
136
861
946
2278
45
1953
171
406
6
21
703
105
3570
6
91
703
1891
4278
741
105
210
1225
990
435
3828
66
1540
2080
91
3160
66
946
351
55
28
1378
2...

result:

ok 98 numbers

Test #14:

score: 0
Accepted
time: 2ms
memory: 4068kb

input:

100 97
870479 594266 17979 445914 279977 701082 808468 978143 124772 925808 486496 725792 13151 914792 840639 180601 194842 81935 895414 306762 943164 688186 185644 68600 41614 718973 668908 952621 806142 891060 222118 647764 302429 649853 411693 527647 102818 427196 466555 290753 496356 16854 65968...

output:

171
2016
1081
6
3
465
2278
1
2775
3570
703
36
1378
595
15
15
36
2016
4095
45
36
1128
630
3403
406
741
36
1830
1770
21
1711
1081
153
2926
2701
780
136
595
91
595
2926
210
15
36
1485
171
325
903
171
528
351
2628
1711
300
435
2775
190
78
3
1540
6
10
903
10
820
15
2278
2926
91
2346
496
210
1035
3655
122...

result:

ok 97 numbers

Test #15:

score: 0
Accepted
time: 2ms
memory: 3768kb

input:

1000 998
7 7 4 6 4 2 1 1 4 6 7 8 8 6 2 7 8 8 5 4 9 1 1 9 6 6 9 5 3 3 10 3 9 6 9 10 2 8 8 2 7 8 3 7 6 4 7 5 9 3 7 1 4 8 3 9 1 1 3 6 10 5 7 3 5 3 9 5 10 9 3 2 9 10 9 7 4 7 5 6 6 6 4 5 2 10 8 2 9 8 7 10 5 2 4 9 7 4 6 9 9 7 3 1 5 3 6 2 6 1 2 6 4 6 8 7 10 2 1 3 2 10 8 5 2 8 2 9 8 3 1 1 4 3 1 2 9 8 2 2 2 ...

output:

52639
55406
72778
54893
31854
3069
4317
385800
65839
83181
191315
12145
14934
27816
39539
80779
151139
242323
57860
14575
225042
8888
9297
130307
106835
20703
71224
46746
4052
2153
101782
16162
2619
2957
31847
145806
174061
63334
173537
124849
6000
38902
14911
17210
104593
14245
96191
41493
47304
73...

result:

ok 998 numbers

Test #16:

score: 0
Accepted
time: 2ms
memory: 3696kb

input:

1000 996
51 45 23 20 19 16 22 67 57 30 61 32 80 46 38 76 62 6 22 74 7 25 20 16 70 78 100 47 39 39 17 63 46 2 11 28 75 51 58 47 12 32 66 62 7 8 57 59 100 29 32 81 11 90 26 16 88 57 39 52 10 6 94 5 93 70 67 26 75 37 6 98 51 88 11 29 97 28 36 41 63 62 66 82 8 32 52 17 95 46 14 2 60 51 15 54 20 80 63 78...

output:

2402
70241
57082
16389
460411
87228
24207
6081
29295
464
23109
1029
76305
816
21438
281265
5750
28316
24211
209
20626
70231
67599
16767
76337
75565
95332
69830
79912
23995
104667
156491
1704
8737
115967
173075
191139
26702
9830
363626
147079
54719
402035
75144
126292
1426
36965
114954
395816
23565
8...

result:

ok 996 numbers

Test #17:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

1000 1000
646 746 291 354 931 823 84 484 142 439 893 10 999 669 753 794 503 753 459 997 46 375 445 106 365 862 458 833 445 387 76 536 430 347 87 577 649 308 764 674 799 229 623 259 159 105 385 108 380 808 79 149 972 318 377 260 555 835 915 882 542 73 647 190 864 41 850 361 937 318 659 392 18 15 279 ...

output:

1430
147618
3569
106439
56590
12244
189327
6782
5250
7996
32359
122703
4464
84206
11320
210
265961
45
40450
33914
29383
19295
45
20296
171310
350
5050
5459
2413
2483
313084
55
6104
4003
3399
14019
28190
37926
230743
73497
199922
7136
28
60348
49120
3485
5993
18903
39035
78159
1225
2016
90473
3398
18...

result:

ok 1000 numbers

Test #18:

score: 0
Accepted
time: 3ms
memory: 3864kb

input:

1000 996
8525 156 5909 2878 6958 7610 1178 9088 2285 9626 2329 4812 7629 3037 137 9397 6502 8279 1731 3105 9715 1633 2117 3898 3588 7368 3409 8272 8877 7020 3515 6534 4005 4434 2286 1872 4184 3778 1591 3435 6662 5849 9512 2133 9650 6969 7399 2641 2915 8740 1741 7508 5142 725 2919 795 7227 951 5816 4...

output:

2774
314807
102376
102828
67160
946
9180
45147
7260
95701
22363
130298
296058
189413
434
178495
496
3321
74688
210269
415402
4465
3239
27729
147148
365073
51678
51357
214833
153731
53299
206396
10
165594
4753
861
207037
41038
595
13203
22578
9453
5565
216144
1325
5886
38501
232896
239076
44549
64976...

result:

ok 996 numbers

Test #19:

score: 0
Accepted
time: 3ms
memory: 4752kb

input:

1000 1000
84503 47470 36151 1858 36249 70169 49861 23790 35769 8439 88417 71033 66247 75932 99021 37885 31352 95044 12591 22229 15973 34090 89843 90849 8105 73586 21126 71812 99271 37888 96412 10917 90177 97694 61228 93073 38114 5338 45007 34968 34005 30117 13124 52363 78732 62645 91983 28612 59738 ...

output:

14365
8911
103284
419068
177308
400063
27028
24090
113049
23871
108810
147152
61775
19701
70124
185743
8385
13203
18720
94394
32640
294527
116402
1377
61075
18145
6105
181501
14364
230179
229501
51680
38781
27028
223445
12561
9180
35510
946
13202
77814
30134
120
64619
4753
227474
26796
9180
51360
22...

result:

ok 1000 numbers

Test #20:

score: 0
Accepted
time: 2ms
memory: 6856kb

input:

1000 996
746942 404907 332060 103389 714995 191748 291638 567887 616738 977031 744755 722024 161175 130095 536035 832948 690949 949370 585465 522053 135872 80107 410575 81582 350148 701001 893405 945609 218476 156318 980102 679602 305916 69753 993868 58954 182232 838189 163478 207221 773514 775184 3...

output:

55611
225456
225456
96580
125250
123752
15225
17766
105
25425
106030
18721
1081
46056
194376
44850
42778
4186
28441
10878
9870
8911
93961
162165
138601
213530
21736
9045
38781
136503
155961
15753
1431
1891
2850
2628
91
7021
247455
6441
23005
13695
4950
5151
33930
408154
348194
1176
4560
8911
259559
...

result:

ok 996 numbers

Test #21:

score: 0
Accepted
time: 6ms
memory: 4020kb

input:

10000 9998
4 4 2 4 10 1 2 5 6 9 6 5 1 3 2 5 8 2 8 2 4 10 4 5 9 10 5 8 10 9 8 2 6 5 1 9 9 9 3 8 2 10 2 9 9 6 6 8 3 1 8 8 2 2 7 8 5 10 3 8 1 10 7 9 9 4 6 3 6 7 1 10 10 5 3 1 1 1 8 4 9 2 10 4 9 10 7 4 5 8 7 2 2 9 8 3 10 3 6 1 10 3 6 8 5 3 4 7 3 10 4 10 1 1 5 8 4 1 3 4 1 3 7 8 3 7 8 7 7 10 8 8 2 10 3 6 ...

output:

2779466
9999779
11467133
12073630
2011120
7323966
4641158
1640774
5405330
37916892
21735043
2595016
13445086
166598
25802701
2644660
10345663
117002
22646598
15449461
30073792
2165316
479112
27674363
6118
58536
14368526
3888733
10958242
5532232
4160075
1338837
8400565
1691228
6817238
39887970
168909...

result:

ok 9998 numbers

Test #22:

score: 0
Accepted
time: 6ms
memory: 3932kb

input:

10000 9998
57 61 48 89 70 22 44 53 15 21 39 35 22 2 44 56 20 65 56 96 30 12 54 44 15 26 26 85 32 69 94 71 74 5 52 79 76 3 62 30 93 71 64 3 23 54 10 21 95 60 72 59 38 79 52 34 47 63 91 14 10 28 76 58 31 59 72 27 29 53 76 73 84 75 62 2 55 64 48 48 58 98 40 100 85 29 98 2 24 78 49 34 73 13 99 98 41 80 ...

output:

15504071
8968251
8837864
137553
270132
21253368
20581528
1389966
762629
4106693
40957475
10568614
7039504
16612967
435851
7001774
27772298
2088030
4274162
11601741
4100905
216607
718955
4747671
123316
9815828
412910
3683280
32631864
375690
18815400
766456
36161
12274830
3825529
11804632
7084234
1401...

result:

ok 9998 numbers

Test #23:

score: 0
Accepted
time: 5ms
memory: 3944kb

input:

10000 9996
359 366 421 622 989 569 505 963 287 914 908 613 82 83 787 690 854 233 234 440 785 902 991 427 778 415 236 115 566 7 464 179 407 714 286 124 96 875 780 608 786 407 438 312 19 111 841 886 241 578 160 947 883 520 107 610 481 848 139 956 567 451 319 114 797 431 481 862 554 437 354 514 405 75 ...

output:

9865
7390239
1022661
2580896
5667231
52305
2245016
37423120
737145
7638318
11560045
1522683
19368876
10789680
719058
8398812
289799
4714707
6190356
2485
9668712
2074697
2015
678845
15010616
29204820
14667423
7180351
6605297
2249237
5881251
3154735
5299864
6977252
21437451
17018310
6371168
65313
7827...

result:

ok 9996 numbers

Test #24:

score: 0
Accepted
time: 3ms
memory: 4004kb

input:

10000 10000
7067 4574 6344 6147 2725 5748 2099 8177 7208 4751 5086 8714 7864 5885 1098 319 9241 4672 2993 4388 7030 3343 4268 3010 4619 9509 9661 3190 3706 896 5143 4176 4938 180 3169 9669 3299 6198 9654 8861 4355 7842 6712 9717 5804 805 6920 894 5412 4867 1344 8413 3012 3730 6569 1353 634 2925 1093...

output:

158201
3716775
561
24875204
248860
31731615
551754
70122
129285
4564588
190
2394681
4561583
14169433
651496
1847934
6805976
3252430
9428353
8884952
112570
10046102
1549628
190
13007157
63186
1653
20489011
384121
744774
15011989
3272875
4683199
11919060
963946
15055896
17793050
30267207
412672
988981...

result:

ok 10000 numbers

Test #25:

score: 0
Accepted
time: 4ms
memory: 5068kb

input:

10000 9996
47386 88111 73076 14985 48076 41366 16872 98608 4274 20055 56782 47462 26475 21030 20440 93505 80536 36474 2233 21499 92546 97039 98123 12049 35537 2564 92938 81701 37877 11262 64822 42333 22689 41188 48501 23521 92587 57217 72559 62433 96462 36613 22832 2668 32393 75876 1322 36858 41661 ...

output:

169070
2241894
20527940
26787411
2671499
19900
5083248
16310544
18171329
21147654
40207859
17301824
1743765
14021107
395604
7146061
10
1628101
398276
1595779
2122819
1396950
2081813
184527
263900
131840
2990222
4186
3472910
1145339
14228394
784374
1658924
210924
11141511
2069583
16339113
9730
873823...

result:

ok 9996 numbers

Test #26:

score: 0
Accepted
time: 5ms
memory: 12196kb

input:

10000 9999
744721 94761 309366 737099 458413 8426 926053 708683 218563 236767 579735 656019 620559 408611 838507 811567 198449 191504 341666 692844 319660 464456 640545 661662 197352 74992 66419 510555 966577 33519 465860 408062 660597 4979 286887 314085 439753 237804 48912 590324 363941 368080 2906...

output:

9221363
7021
15924542
31082660
7440151
44128303
42287794
26970831
3829528
1209790
10794979
20419241
482653
142845
2694681
8654878
44250513
12880
12140124
1502511
4775595
4655823
9110044
2039190
7986004
21822911
33714356
178503
15271097
12632848
5328478
1497315
31541643
38689195
21375983
427349
16974...

result:

ok 9999 numbers

Test #27:

score: 0
Accepted
time: 60ms
memory: 6432kb

input:

100000 99998
7 7 1 1 1 7 9 6 7 5 1 5 1 9 9 6 4 7 4 5 2 7 7 4 5 3 10 9 8 2 8 7 10 5 9 7 2 2 1 8 5 5 2 4 1 3 3 1 9 8 1 10 3 2 4 10 2 7 5 9 7 2 4 3 8 3 7 6 6 1 9 8 2 9 6 6 9 5 7 4 2 2 2 8 4 7 2 8 2 9 6 10 8 1 10 2 10 2 9 4 2 10 10 1 8 6 10 7 4 5 6 6 9 9 10 2 3 9 10 7 2 10 1 6 10 9 9 10 7 10 2 8 6 10 5 ...

output:

9968031
166915679
930322425
29718962
1245826129
388355727
184212068
369127281
4401193271
106531181
1111648864
1229617727
255129804
1306384897
1292541569
585499108
2983421113
347673520
127141549
22658197
1843
159234579
297363852
1377060401
529159514
185840105
201028918
701548716
561527824
47097578
35...

result:

ok 99998 numbers

Test #28:

score: 0
Accepted
time: 63ms
memory: 6432kb

input:

100000 99997
64 96 100 13 36 25 61 10 57 74 90 13 95 81 14 6 26 53 85 49 92 69 6 33 15 71 98 87 25 70 78 4 17 28 85 20 4 93 64 44 46 50 56 49 29 79 95 98 26 33 95 10 79 64 65 7 46 54 56 84 48 87 88 28 7 75 95 58 1 71 79 31 83 4 13 71 27 74 72 76 66 2 13 68 50 41 89 28 77 51 37 88 100 73 73 48 21 76 ...

output:

3819975
252506916
72335521
1047847719
1664556580
14801339
1789353439
2170575815
600713337
1749753432
585004948
62570272
1247732541
1145230067
930356085
10827192
3477620784
178575785
150383
380947653
2270738854
1351927888
28145713
229441712
1655297468
2238566314
664051009
163788210
213397482
77069793...

result:

ok 99997 numbers

Test #29:

score: 0
Accepted
time: 58ms
memory: 6444kb

input:

100000 99999
23 753 254 507 289 579 496 342 817 709 888 446 638 91 221 34 10 478 132 147 861 679 575 935 808 296 993 399 3 475 107 458 744 201 626 496 157 884 775 487 838 149 853 193 681 504 159 491 200 667 775 528 851 779 1000 301 59 142 93 178 799 242 432 399 971 596 668 437 292 330 763 728 454 82...

output:

70585974
82797432
1797412666
237145456
1037191266
2579555031
431307782
1386782231
153286288
3746260309
335305916
2104944367
522480
1049245930
2728313
6012290
206929482
346215424
134487845
1302694837
1408134185
3046014002
19487587
2321656375
180326235
85011569
1965405790
725202415
2860176515
37769704...

result:

ok 99999 numbers

Test #30:

score: 0
Accepted
time: 65ms
memory: 6660kb

input:

100000 99997
197 6137 6922 6475 7769 9788 8327 6752 2924 2880 3639 2237 9232 5076 1150 4643 330 1946 1412 9334 6261 4746 9621 3167 2221 8574 8159 4363 7797 4596 1064 8585 7474 4751 8453 6368 1309 9510 9732 9688 3189 8931 1107 9644 6842 2997 358 462 2019 974 7125 2130 5354 6086 1644 6546 2010 7078 81...

output:

244451748
1342298
519032220
1963986301
701023753
1465119090
1165467615
3033372257
2094630898
28655349
873446963
425679339
1069799265
10911111
589307838
100710403
419661033
10925167
463724175
905925673
1021601759
174643304
11637514
892694067
84933494
169762802
318430703
1953721538
19452598
372702006
...

result:

ok 99997 numbers

Test #31:

score: 0
Accepted
time: 70ms
memory: 7516kb

input:

100000 99998
441 98689 49146 23079 61820 70822 96220 74615 79389 2143 17152 16063 92629 61930 48081 33885 69312 58346 21532 95605 38174 59395 36405 94799 85973 40703 95730 49398 42925 73772 82574 46875 35859 59163 82631 74800 53910 51170 25792 22766 14317 9115 92576 96655 57103 73091 93553 76597 855...

output:

2374043844
3359404475
1197777413
684552914
531994
131600426
819453787
32196185
16082888
886433108
2720959005
166722265
163397365
368166300
56195712
93509318
1536929483
722472364
538198
251540274
154659481
2668031283
2314609802
915974
2518396169
2526351059
1540257857
197676056
9881211
58996
292419701...

result:

ok 99998 numbers

Test #32:

score: 0
Accepted
time: 105ms
memory: 14632kb

input:

100000 100000
473694 335310 489886 390885 129055 839113 105312 902525 359838 985754 372944 525726 730901 957319 569003 192673 917665 537756 408719 173985 355780 161446 867648 644800 213028 796089 812582 48547 802505 16748 303245 713394 96418 975960 19299 860185 968257 437788 682045 404361 117467 316...

output:

2565606276
2226678914
889976492
1867001262
249995847
171300723
362356469
325418149
2100653103
1225644212
220384427
64792009
128778
1895954885
810815892
48762719
48270210
1838876798
1333060156
3691937713
401223457
409852540
2407913
2125225567
1532447059
4163054
2817788569
6431486
2880062026
841299266...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 85ms
memory: 14576kb

input:

100000 99995
3 7 3 1 6 6 10 3 3 3 10 9 5 10 3 7 5 6 5 6 10 9 10 3 1 4 6 6 1 4 3 1 3 1 4 10 1 10 3 6 7 9 5 7 2 2 5 7 4 10 1 3 3 1 4 5 10 10 9 9 5 8 5 1 1 3 9 8 4 4 8 10 1 7 3 9 3 2 2 10 10 8 2 7 5 3 10 4 9 3 4 3 9 4 8 8 8 8 9 9 2 10 9 8 1 2 5 6 8 2 6 5 3 7 6 1 10 9 7 4 8 6 9 10 1 2 1 3 4 5 9 7 8 8 3 ...

output:

1966651246
3981427630
111138961
498409942
134045235
1119787345
2501641595
394397222
1120092928
523373020
414997338
3074042097
421679443
917328754
1394772748
2395034182
2234502109
172098405
90251360
1436852995
2481576107
865630186
10623049
1274836723
779011342
2742285
221873809
1031399049
702482719
8...

result:

ok 99995 numbers

Test #34:

score: 0
Accepted
time: 77ms
memory: 14568kb

input:

100000 99996
8 1 1 1 3 10 6 8 4 9 3 4 3 3 4 10 4 10 5 3 10 5 9 1 5 6 6 5 3 4 7 1 8 3 1 1 7 2 4 3 7 6 6 8 10 8 6 1 10 9 10 10 6 8 1 1 8 8 1 9 2 8 3 6 4 3 2 1 5 4 4 10 4 5 10 5 7 8 2 1 9 2 8 3 10 7 3 5 9 9 9 4 7 5 3 3 4 3 10 2 10 8 10 9 3 8 8 4 7 8 7 3 1 5 6 1 5 1 8 5 3 4 5 9 5 6 4 5 1 5 8 9 3 7 1 6 7...

output:

1555247003
189741851
91760
2486037747
1490385038
700433238
89090996
42860228
66925074
974806080
144789329
86006706
1953067983
1243942435
16139940
4271367815
310042596
1596431129
2954300346
752830817
41767651
572327815
34814861
452638658
4578518135
840454
61036179
1997127810
1017424999
512553793
1898...

result:

ok 99996 numbers

Test #35:

score: 0
Accepted
time: 74ms
memory: 14552kb

input:

100000 99999
1 1 5 10 8 2 8 2 4 2 7 3 4 6 4 3 7 10 10 2 2 4 2 1 8 8 1 10 2 3 10 7 7 5 5 8 4 8 10 8 9 7 3 6 5 9 4 2 2 1 3 10 6 7 9 9 2 10 6 10 4 10 7 10 9 10 1 6 1 3 8 6 3 3 2 3 10 7 3 1 3 7 9 8 7 5 10 3 5 8 2 8 6 2 5 9 9 6 7 8 7 2 8 8 3 5 7 6 5 6 2 4 7 2 8 2 2 6 8 7 4 2 4 5 7 3 5 6 2 1 6 10 7 6 6 3 ...

output:

741949716
831469592
3070407757
431459736
52926588
37078947
5724026
586993248
550770253
6370643
1889040804
4208875565
3169516475
253968758
3243917987
2451057897
114299433
1260646352
523568285
652597258
564462354
684849820
178029989
71837820
4735485
487951197
282494097
179168980
151525
627410343
19937...

result:

ok 99999 numbers

Test #36:

score: 0
Accepted
time: 81ms
memory: 14564kb

input:

100000 99992
6 9 6 3 8 1 8 2 2 1 4 7 9 7 8 1 1 8 3 8 8 8 6 7 7 1 4 9 1 10 2 8 2 6 7 6 1 7 3 8 3 10 2 7 2 6 9 6 2 2 10 9 5 3 2 4 7 4 7 8 10 6 10 4 3 2 2 2 3 10 1 7 5 5 8 1 8 5 9 7 10 7 5 2 7 5 3 6 6 8 8 8 2 2 4 10 7 9 7 8 9 10 2 8 10 4 5 3 3 6 3 6 10 7 1 5 5 2 5 2 3 10 10 2 6 8 10 5 2 3 5 2 9 6 5 1 8...

output:

3544448
1480901
162602663
64065348
2276803941
622955873
2631169376
381103482
759632637
46170961
400911733
1846079
1143541316
92337186
462989564
1373334829
173685866
288515973
281188430
452342273
76514289
149740077
3146271744
1645799246
1499548741
827727459
4242256675
653216328
883360688
167325811
87...

result:

ok 99992 numbers

Test #37:

score: 0
Accepted
time: 79ms
memory: 14632kb

input:

100000 99997
1 1 10 8 10 3 2 3 10 5 5 5 3 2 8 9 10 8 1 2 5 9 1 6 4 2 4 9 2 5 6 1 9 8 7 8 9 6 9 1 1 10 2 10 1 10 9 6 7 7 4 8 1 6 9 10 6 7 5 10 8 6 3 5 7 5 6 5 5 4 10 10 9 2 6 4 4 9 3 2 2 6 2 10 10 5 1 10 3 4 3 2 4 3 1 8 10 9 8 5 6 5 9 8 7 5 10 1 4 8 9 6 7 6 10 7 7 4 1 1 2 10 9 6 3 8 6 2 8 9 7 6 10 1 ...

output:

163397820
360151669
139837410
34108903
1418761634
178475228
1029959123
147630335
259153636
60569990
1429057357
716954112
2117877005
482530861
93522766
175101253
895975817
775490114
1904317604
33129684
2671742615
3589754
62579759
1068078911
372165708
128760759
1127363821
478315216
670833792
5303015
2...

result:

ok 99997 numbers