QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#591839#7082. Edges CountingAfterlife#AC ✓365ms39036kbC++201.7kb2024-09-26 18:19:182024-09-26 18:19:18

Judging History

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

  • [2024-09-26 18:19:18]
  • 评测
  • 测评结果:AC
  • 用时:365ms
  • 内存:39036kb
  • [2024-09-26 18:19:18]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int mod ;
const int N = 3000;
int c[N + 5][N + 5];
int f1[N + 5] , f2[N + 5];
int g[N + 5] , h[N + 5];
int t[N + 5];
int qpow(int a,int b) {
    int ans = 1;
    while(b) {
        if(b &  1) ans = 1LL * ans * a %mod;
        a = 1LL * a * a %mod ; b >>= 1;
    }
    return ans;
}

void init() {
    for(int i = 0;i <= N;i++) {
        c[i][0] = 1;
        for(int j = 1;j <= i;j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
    }
    t[0] = t[1] = t[2] = 1;
    for(int i = 3;i <= N;i++) t[i] = 1LL * t[i - 1] * i % mod;

    for(int i = 1;i <= N;i++) {
        if(i == 1) {
            f1[1] = 1 ; f2[1] = 0;
        }
        else {
            f1[i] = qpow(i , i - 2) ;
            for(int j = 3;j < i;j++) {
                int num = 1LL * c[i][j] * j % mod * qpow(i , i - (j - 1) - 2) % mod * t[j - 1] % mod;
                f1[i] = (f1[i] + num) % mod;
                f2[i] = (f2[i] + 1LL * num * j)  % mod;
            }
            if(i >= 3) {
                f1[i] = (f1[i] + 1LL * t[i - 1]) % mod ; /// big circle
                f2[i] = (f2[i] + 1LL * t[i - 1] * i ) % mod;
            }
        }
    }
    g[0] = 1 ; h[0] = 0;
    for(int i = 1;i <= N;i++) {
        for(int j = 1;j <= i;j++) {
            g[i] = (g[i] + 1LL * c[i-1][j-1] * f1[j] % mod * g[i - j]) % mod;
            h[i] = (h[i] + 1LL * c[i-1][j-1] * ((1LL*f2[j]*g[i-j] + 1LL*f1[j]*h[i-j]) % mod)) % mod;
        }
    }
    return ;
}
void solv() {
    int n ; cin >> n;
    cout << h[n] << '\n';
}
int main() {
    ios::sync_with_stdio(false) ; cin.tie(0) ;
    int t;cin >> t >> mod;
    init() ;
    while(t--) solv() ;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 364ms
memory: 38768kb

input:

7 998244353
1
2
3
4
5
6
7

output:

0
0
3
60
1050
19380
393750

result:

ok 7 tokens

Test #2:

score: 0
Accepted
time: 360ms
memory: 38960kb

input:

3000 1053818881
1256
234
2691
86
1204
2625
904
1996
2937
2621
1117
2922
299
864
2321
1836
1966
481
2514
1911
432
1807
1624
1362
1507
242
2434
2979
1244
996
506
2861
1957
1187
1199
331
2656
601
133
737
466
1904
2499
28
945
1680
2624
1318
2430
546
1342
948
835
233
84
1145
1630
1931
2992
1181
2261
2817...

output:

125083503
23075487
577214797
600297359
349413480
419944183
1023237336
576865259
378752326
960481976
158247367
992184256
332697059
565318091
509439708
445239228
908211751
284927482
211027208
988887406
853964140
248863358
825713897
556471431
504241311
531469393
298493647
367111776
601221569
176490962
...

result:

ok 3000 tokens

Test #3:

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

input:

3000 1051721729
1899
2869
1036
2218
2971
775
500
1681
1984
230
1849
1031
1229
181
2610
1283
896
1415
1517
2541
1478
1044
927
1420
1296
1583
96
1909
2157
830
1708
1262
990
2669
2766
704
2432
597
2268
1863
1158
2440
518
1309
60
2942
2518
2734
1389
536
1110
1213
382
2826
1216
2948
1496
1760
252
1277
21...

output:

890814879
161535731
65927074
609730656
494225959
426424636
152720052
806831785
887961509
875132839
153640429
712952294
627828451
663622512
429651987
815832452
989645527
402496732
746644921
1002749060
182813000
863324558
498046723
374727005
230501092
655956849
199468685
690093136
336020870
706656160
...

result:

ok 3000 tokens

Test #4:

score: 0
Accepted
time: 364ms
memory: 37908kb

input:

3000 1045430273
266
2328
575
2554
2180
2154
2829
191
2253
377
867
1906
32
1778
2440
2500
28
1061
2687
1192
2690
2842
1769
2456
778
834
1570
727
1511
1313
2662
1932
366
1841
2510
2312
1916
132
2378
435
1101
676
2475
1389
1689
2479
2762
2394
1283
374
723
916
2013
1740
1170
1358
558
1985
957
1430
944
5...

output:

763186318
891372407
80501807
374556319
716442117
568936529
783514429
739613144
347380918
474977625
887655823
694211419
230332022
844919670
307196907
465040090
774920393
440148013
1002521487
176389289
676807526
75095811
828662969
974522186
463627694
443662462
650120633
156326643
232442217
135601616
8...

result:

ok 3000 tokens

Test #5:

score: 0
Accepted
time: 364ms
memory: 38140kb

input:

3000 1012924417
2313
566
1879
2367
66
779
207
342
1676
795
2780
936
1059
1377
216
1175
2286
530
1657
871
1489
2475
40
941
1652
2923
552
158
293
1513
1407
13
1898
2227
1424
2380
2116
2068
905
2125
2253
1613
2471
521
148
2724
2381
2176
2819
2306
847
1200
1704
1913
2353
744
433
351
2634
858
754
2787
10...

output:

438350942
628898460
17638951
661765997
273654746
830412491
945705178
468273381
340335720
341995598
503252004
148048175
912133757
453834126
942199421
767670135
812634242
842361146
818808067
938252785
312216804
766006129
116151940
653783098
704907266
681787534
849408828
679028680
180503510
644544344
2...

result:

ok 3000 tokens

Test #6:

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

input:

3000 1007681537
317
1556
848
139
483
1730
2844
1447
2753
1775
1460
722
1104
2154
1431
1146
21
2953
867
1161
105
770
2109
2857
1402
1662
1526
2977
164
807
2218
215
1193
1059
1311
2582
2997
698
2364
1743
1162
2037
1768
2323
2809
1516
2148
16
2759
1696
570
2823
1397
1314
1523
1840
2025
1684
2450
227
31...

output:

551021964
584516892
127136513
401933119
119816168
613218755
362004106
659504078
585463352
608941696
121881309
602703065
516080623
142540529
676395506
584164900
34678385
153650755
760595692
185192216
798071778
223255472
358286231
622895861
573091341
441652633
667708774
393916137
772657921
752660903
8...

result:

ok 3000 tokens

Test #7:

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

input:

3000 1004535809
885
2021
2206
1522
1754
1884
1361
1176
920
1998
1356
1868
460
515
2643
1272
1061
1937
1942
2211
2426
1205
1405
433
520
226
2834
2601
1494
464
1660
1922
1560
2587
1815
1743
229
2082
1331
1420
2297
2570
563
2044
279
370
1191
307
984
1762
360
1125
974
1065
91
136
578
542
8
2596
2195
186...

output:

826237785
220813753
82648557
324382202
82206483
656017505
565582813
430984684
969343241
571670794
280231413
375028210
514065741
523503276
177002590
959908403
984649894
126899715
781548101
102116624
122884230
556427712
418086679
34118954
257409930
602025522
785011527
30919353
852098970
609487291
3185...

result:

ok 3000 tokens

Test #8:

score: 0
Accepted
time: 361ms
memory: 38120kb

input:

3000 998244353
888
1475
1482
27
1735
2773
2323
2216
2111
1472
1639
2114
972
687
2461
2469
1022
1388
1659
66
2845
2257
2721
782
2949
282
1018
1320
2202
2912
615
277
1300
1168
249
434
365
478
2233
2754
159
2219
1971
2085
1846
429
2335
38
1292
1396
1552
1497
251
906
910
2923
2693
862
652
1655
1705
2687...

output:

315518745
691752904
189844394
299197280
935655277
24848777
210064300
327727938
527619595
388237159
69219014
382203553
739000794
220201457
874327747
969082511
653362391
488920149
597907005
299325240
982903733
740009190
769585838
103664700
493299060
607898209
121972903
440503619
340540700
884680388
90...

result:

ok 3000 tokens

Test #9:

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

input:

3000 985661441
1783
1498
134
2172
568
2139
209
1628
2898
359
2997
267
2934
1245
75
2540
2328
244
2453
1724
2766
617
1639
2365
2990
1739
151
1540
1683
2145
987
1329
2929
2462
474
1658
2344
2306
388
2282
397
2395
2455
2747
2645
1372
905
2856
536
2397
1461
1386
1895
1839
1420
1468
1255
871
1773
351
463...

output:

232645711
79972453
256951578
790994373
235210002
546764724
818624178
872055714
863096634
619187054
297634864
277493939
963265237
217519431
16198426
845477125
731513389
132421170
195385391
103840420
268362202
480158381
408908424
653469289
397689569
77670774
560788240
234143097
322162334
889099913
895...

result:

ok 3000 tokens

Test #10:

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

input:

3000 976224257
2956
283
2763
583
2559
2810
2874
2736
640
555
1754
646
608
267
2251
1950
1088
2507
254
880
1696
1312
1552
911
1321
1841
2148
23
2373
2205
1293
375
2993
412
2702
1525
2646
1113
1271
170
397
131
1774
704
1077
2404
135
228
144
2451
1441
2673
1467
2100
2131
1867
1970
2113
2625
1059
2793
1...

output:

634946822
225829703
737870483
513540527
565888475
971795528
341909838
492864097
502112384
816077889
432778833
68752311
576696113
628854327
821987090
163806581
312673582
589984471
21554694
124067277
599743302
282767001
740215758
258409413
841863512
943932261
128254894
158273901
574932478
139040631
60...

result:

ok 3000 tokens

Test #11:

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

input:

3000 975175681
1176
2959
2494
2498
1366
782
2812
1456
1386
704
1238
1194
1162
2640
2052
198
603
1573
1327
1198
2871
2162
114
447
989
2568
47
1192
2872
2826
894
541
904
1424
856
1361
268
1883
2102
2904
662
1593
971
1125
2878
258
347
1350
2023
235
2805
550
2189
1358
480
1844
2685
2689
444
1984
612
268...

output:

328687457
423546467
332731853
161386051
961259695
935891244
735939707
460163572
897912495
366024580
595923492
788695586
353370158
716170092
207825649
587483621
948033366
168225711
804622030
260573945
632921596
748238168
891454887
81571886
290896651
466292619
723479813
653491184
796731489
584334493
8...

result:

ok 3000 tokens

Test #12:

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

input:

3000 1000000000
2219
457
434
607
1234
1038
712
944
59
312
1862
94
11
442
765
38
1131
2852
787
1027
761
1003
1328
1433
898
1022
1177
1489
329
81
1812
2704
956
458
1158
2834
490
2026
1211
1325
1814
463
2747
528
1138
1278
1403
1232
213
2976
207
2271
2677
2964
1848
2119
1469
968
137
16
2941
2723
241
735...

output:

134748160
0
603235120
0
919587920
165850308
265625000
764445520
381299840
609375000
445312500
564563380
795838390
890625000
413056000
339220308
850245120
710937500
0
0
886512640
342384128
138725328
866546688
874412928
7812500
0
204812800
546155520
763409920
242187500
205077360
828931580
754508888
41...

result:

ok 3000 tokens

Test #13:

score: 0
Accepted
time: 360ms
memory: 38848kb

input:

3000 1000000001
1347
885
1818
2067
1572
849
2229
1072
1862
1157
572
1565
1500
235
1044
2211
838
666
2865
2727
1242
158
381
670
291
2484
278
1461
1145
2957
908
1685
183
2965
1053
577
2924
2646
2808
2917
2107
2606
1824
102
327
631
1713
1687
2391
2016
1528
2583
746
1520
1677
164
2068
1745
1452
2288
202...

output:

34991572
224065842
34154673
157776892
568407662
841996848
465564372
975086112
996253790
110906796
811845034
207203448
563687712
418254876
364031948
594341891
585480896
788250967
19756968
322831947
846935901
339456793
408304680
618319331
337418169
424474271
647369583
757399692
905708661
597487163
363...

result:

ok 3000 tokens

Test #14:

score: 0
Accepted
time: 364ms
memory: 38484kb

input:

3000 1000000002
2771
885
2442
529
1909
2706
2624
876
1505
40
1504
233
2971
2913
2689
340
720
514
1659
580
730
2291
2012
1120
1540
676
2585
2289
2634
1731
2170
2
618
2103
948
1382
2394
1320
2746
927
2400
2492
2483
956
1579
1079
194
2212
793
427
2338
2719
179
2822
9
696
1387
2522
1881
1089
275
118
252...

output:

290329602
149617254
335753550
944643174
568067454
294640560
396819222
185426562
383666640
963902496
874124712
511272924
1344144
766878828
382290588
483395124
512890050
865354722
335394150
754552992
217355316
847955004
901298496
869684202
787975170
452067696
442953306
544179972
680101812
396431052
40...

result:

ok 3000 tokens

Test #15:

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

input:

3000 1000000003
1195
1864
549
910
2507
2043
2466
1328
1149
885
2939
244
2609
2706
1348
2512
427
2160
755
1412
2623
1450
260
358
933
609
1918
2179
2698
504
1266
2815
558
1643
2775
2090
984
923
551
2520
2180
1185
184
530
568
2293
1630
2737
2971
2417
2456
2316
485
2032
1121
1686
1986
356
590
2832
2298
...

output:

52013719
631763839
662089544
755365654
28415879
102319009
910466299
407215686
253840240
124473539
47265062
369382481
501941009
936407146
675276951
655911732
505138786
313950182
433984164
570572564
534933149
437983342
432690454
513710445
140984938
759144003
815706472
211266353
579471326
977327216
721...

result:

ok 3000 tokens

Test #16:

score: 0
Accepted
time: 360ms
memory: 38892kb

input:

3000 1000000004
2619
1863
2415
2807
2844
2378
1543
1132
2952
702
1913
186
2259
52
1179
1699
2509
2009
2833
996
123
605
1891
1931
326
2071
1019
1213
543
2248
2141
1995
2753
1183
278
2896
1333
2560
2149
2848
2473
369
2347
105
1821
2741
111
239
1381
828
2920
2627
630
2680
949
2675
2585
55
1355
1301
281...

output:

421275932
959480964
382097672
295787448
110382728
193923440
268742128
453019316
970060328
64390852
590833848
234941284
435504892
585737064
677072256
599107628
424618412
995255648
104359992
940045316
242245220
842726452
750514760
815913176
490222316
136147364
274204244
438707676
914911444
623058428
4...

result:

ok 3000 tokens

Test #17:

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

input:

3000 1000000005
1747
1434
41
1269
186
1715
1384
1260
1764
2576
622
1656
741
1018
2824
840
1784
672
287
1831
2592
2739
544
1168
1575
262
584
2041
607
1331
1237
995
1980
724
172
2360
2887
116
2917
858
878
2723
48
958
809
587
1547
764
29
2819
433
2763
935
2545
565
808
2159
1726
2670
102
1897
1652
2575
...

output:

363054090
312784125
411256845
196489425
80494980
498673710
300650535
30274515
298009035
339725505
732086565
317673645
638736780
620512458
100627335
560398665
111831435
980326920
886346070
65763375
987643350
960824370
896077395
872840133
87204225
153114825
869289825
931750605
26355855
431747265
61038...

result:

ok 3000 tokens

Test #18:

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

input:

3000 1000000006
2467
1862
1906
169
1348
1052
1015
1712
1407
430
2322
1598
380
1350
2655
27
1490
520
2365
547
2081
1897
2176
1618
2824
196
2892
1931
2095
105
333
176
1207
2828
1999
1444
2357
736
2854
1187
1171
1907
2083
533
2754
2895
1978
1289
2785
498
897
1821
1516
245
605
1798
1734
2503
1043
1844
9...

output:

828300290
719703198
444546550
702436056
536798428
498606324
469301028
959412884
893392476
242514204
459650168
56989546
598720314
523981212
783629954
449657998
377289722
509237224
147131674
8265938
883596880
947114816
952133170
923657384
167633112
799087498
174744432
607566986
353376564
228310352
694...

result:

ok 3000 tokens

Test #19:

score: 0
Accepted
time: 360ms
memory: 38104kb

input:

3000 1000000007
1595
1861
2530
1629
1685
1387
303
1516
219
247
1296
336
18
2316
1315
1141
1373
2166
1160
1381
2561
1060
423
855
2217
129
1993
965
2160
1849
1401
2105
1146
2368
1894
908
2911
2373
1490
1082
2327
1793
2742
2754
1051
388
1464
1744
1187
269
1873
2672
1386
2203
2071
2876
2333
337
1808
313...

output:

846345919
181640786
590577641
669218557
186697291
5026277
540783925
383338737
946763635
946673376
47109514
910648926
182527688
309956881
798910949
19548465
395924529
84461990
860985791
579190803
612534237
105400582
822860414
248914737
677948795
125016656
943241957
266058896
334956893
115198069
68172...

result:

ok 3000 tokens

Test #20:

score: 0
Accepted
time: 360ms
memory: 38600kb

input:

3000 1000000008
19
2290
915
2446
2283
723
2928
1644
1062
2120
2995
277
1488
2649
1594
328
1079
1166
256
100
1474
211
2054
1306
490
1378
1326
1793
2976
622
303
1106
1581
1506
2937
1713
2380
1976
2257
789
1244
486
571
650
2996
2696
1895
2269
413
899
2337
48
1255
758
1899
920
1652
930
181
2056
53
248
1...

output:

801278100
287754768
338239104
431663148
982512888
575572872
135193128
145472268
350744436
307965120
901479528
680039280
366254088
32630304
228591216
808838424
28962696
420568404
47692656
408222612
455098032
788934888
531220788
105884496
311377248
677830680
87971604
124377120
727345920
192131676
8674...

result:

ok 3000 tokens

Test #21:

score: 0
Accepted
time: 360ms
memory: 38892kb

input:

3000 1000000009
2147
2840
1539
909
2620
2581
2769
1772
706
2966
1969
1748
1126
1801
2791
2500
354
2812
2334
932
962
2345
708
2879
2859
1312
659
1683
1412
2367
2369
286
808
1046
2831
2421
1850
2596
63
2382
1025
2630
2606
225
1984
189
1381
2794
1775
671
196
1865
2272
2715
1515
1453
1227
2437
1497
857
...

output:

834291160
584633839
605553942
355080319
904703189
536437870
578196030
79269928
830811670
824343435
346200070
370912730
241318276
419426056
838474938
739035395
914447311
134528165
135654524
393996296
36016442
379091568
853262993
905924800
994891829
376319225
339396963
781949262
187184660
36407751
227...

result:

ok 3000 tokens

Test #22:

score: 0
Accepted
time: 361ms
memory: 38092kb

input:

3000 1073741815
716
1827
2553
2588
630
1568
2654
2971
310
2521
2761
790
2194
1705
2076
1252
1098
190
2460
2166
1474
2922
1259
2216
1300
2172
2486
2143
172
1982
2871
1092
266
143
1186
1283
619
2587
2400
2267
849
1935
1928
605
1018
2388
1478
1898
293
1202
1344
1895
1885
1119
840
1763
1124
2636
2237
94...

output:

802270035
702719950
1028553013
728036138
286426120
29599503
897321760
377726620
469310345
616859390
310524290
727215855
413088040
584411320
696962690
230649230
799977668
972880810
174669995
1015224665
701513150
25760125
1035649150
934369700
185811080
237481065
1016395525
173397308
861704545
56801729...

result:

ok 3000 tokens

Test #23:

score: 0
Accepted
time: 365ms
memory: 38836kb

input:

3000 1073741816
2844
2378
179
1050
967
431
2496
106
2114
1403
1470
2261
1832
2671
287
2366
804
887
1556
20
387
2084
313
1453
693
659
1819
2115
1660
1321
2161
72
2461
2651
47
1991
89
244
206
899
1141
1120
1133
3
2271
1742
2913
2493
2471
2564
1808
1491
1319
2622
669
2841
1723
286
946
2688
2957
14
43
2...

output:

160668788
56542416
564915824
737135616
874327888
501142240
71030264
279781432
185053792
63665000
884519020
579938016
911504944
1004608504
948293640
254759428
96850268
144079040
237813436
1069851532
833223048
348435164
240287768
568872896
483442792
1066980264
251913128
831400192
824398540
222040336
3...

result:

ok 3000 tokens

Test #24:

score: 0
Accepted
time: 360ms
memory: 37860kb

input:

3000 1073741817
564
2377
802
2947
1305
2763
1573
1620
925
2249
444
929
314
1189
2380
1507
79
1684
1992
855
2855
1239
1538
1904
86
593
1153
2943
1724
660
1257
2242
2400
2191
2908
2797
2523
864
973
1228
922
514
1792
1033
1260
681
1395
498
873
1604
1926
1088
2336
977
2135
886
1298
1063
1711
2638
1208
1...

output:

491443596
637662063
47621919
410072004
716150082
970826199
164339886
754702077
914813118
790334193
108739062
976542888
758970573
727783668
478463538
29461122
377875281
134312343
647558208
599591763
465687798
314702451
201487965
656979426
14736015
670291704
42290400
45378228
328646487
795895101
73856...

result:

ok 3000 tokens

Test #25:

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

input:

3000 1073741818
2692
2376
2186
331
1338
577
1968
1424
2600
2066
2144
2400
2941
2155
1763
694
2769
2381
2428
2552
356
394
191
2354
215
1759
486
2833
2541
2405
2131
1202
1627
1328
2802
540
1993
2501
1741
2198
2799
2658
869
607
448
2990
2830
953
99
2965
2735
1939
2205
187
1963
1875
873
2570
84
2900
255...

output:

799644922
865010754
962988724
234476136
395929378
514222698
793874386
127674116
267927838
635612042
1059019846
577948128
718231514
1010059860
576780582
1020502332
745717498
708551986
944572696
674775162
303901034
905096694
326235818
1048335554
871846208
605524802
83123792
343008792
305817926
3271192...

result:

ok 3000 tokens

Test #26:

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

input:

3000 1073741819
1116
2376
293
1790
1676
2434
492
1876
1412
948
589
2342
2579
2488
870
2866
2043
196
2864
405
2824
2524
1423
2804
2584
246
2561
2805
2605
922
1228
383
854
869
305
1345
582
158
2508
830
2580
1351
1528
182
1701
483
2136
1478
1453
2005
761
997
2074
1490
1791
2496
1471
404
1399
45
807
126...

output:

129605725
683156260
180853536
496939735
357270914
285561753
70582572
118157922
143223053
1008097519
456220250
443653976
963210837
199454941
1068609566
834610441
612157362
932763907
363103519
931856357
213846668
546869908
851116135
154890138
829291540
909402356
609161509
292918815
426637534
550668669...

result:

ok 3000 tokens

Test #27:

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

input:

3000 1073741820
303
85
2665
1000
2371
112
2271
198
918
1967
1942
2210
1558
127
1209
2105
2986
342
440
1789
795
249
2879
343
2246
2313
2447
1126
1708
597
220
2914
2945
2755
1299
1712
2598
1772
195
1953
1856
1778
328
2569
1358
150
674
499
2966
2486
136
260
196
614
2374
2192
1274
1781
1293
856
1002
256...

output:

573540708
50436180
865842180
723932220
602954760
535185000
753682080
734989788
565427628
987884640
790047420
678313260
1034064348
418833300
542068080
747324180
931910160
231920580
470769300
710210760
205295760
207627900
218173140
642956088
36059940
845002848
301794360
277859520
576322488
735654720
9...

result:

ok 3000 tokens

Test #28:

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

input:

3000 1073741821
2431
636
1254
1818
276
921
1348
326
562
1784
651
692
1196
1632
2854
234
2692
190
2518
2623
284
2383
1532
793
1639
800
1548
1016
2525
2341
2480
1874
1677
2699
1194
2517
2068
1375
132
2924
772
1172
1115
2144
2611
2459
1106
954
2192
1526
1458
396
778
1262
1990
8
1872
2558
2394
2598
2194...

output:

925137045
1007870724
929310000
112657703
431879211
813208217
40000644
273560234
75310691
485575416
694411863
1058119324
393094518
636483017
961088649
870137056
756932921
986484783
890405532
849195006
617096420
543000705
845799622
1001513909
657525767
815265112
962864450
626498877
945161707
818534224...

result:

ok 3000 tokens

Test #29:

score: 0
Accepted
time: 360ms
memory: 37968kb

input:

3000 1073741822
855
1064
1878
2840
614
2778
1189
454
205
2630
2351
2162
2666
1425
147
2406
1967
1837
1614
1339
2752
1538
185
1153
1032
1966
1113
1925
2589
1680
578
1054
2112
1836
2237
1982
22
1995
900
1556
553
357
192
2687
1599
2906
592
1409
594
2887
1576
2942
647
1909
722
1315
1447
392
431
2860
127...

output:

976154792
934899634
774099022
587638826
618877726
1029818738
187574072
759317830
739419974
777781628
751605472
887475896
279239394
255956698
276689612
300154164
572113712
440350192
364902060
172768410
360884288
1027385984
829513448
552675850
579383838
57797002
374679146
523920720
354334836
104051902...

result:

ok 3000 tokens

Test #30:

score: 0
Accepted
time: 360ms
memory: 39036kb

input:

3000 1073741823
2279
1063
264
1740
647
2115
267
582
2009
1512
1325
831
2304
2930
1344
1593
1065
1685
408
2174
1665
696
1811
1603
2281
453
301
1815
1105
454
2450
55
2547
1376
2132
1066
128
669
2497
187
2222
2500
851
584
788
2613
1023
2004
2772
1195
2385
305
516
1774
338
2393
2046
1169
1746
1661
1792
...

output:

445193991
17736192
603018339
181112712
267299382
819402255
332162439
580074537
842068269
538283592
456242787
250250196
755879355
697989660
805164360
763435467
638456889
58643739
37124241
445988589
888193323
594700764
237519450
893887722
36899154
340892013
321890751
877703442
60944994
822791601
39835...

result:

ok 3000 tokens

Test #31:

score: 0
Accepted
time: 360ms
memory: 38004kb

input:

3000 1073741824
1407
1063
1369
203
985
2924
108
710
1652
1329
2760
2302
111
910
1623
780
947
2482
2487
893
2145
2830
464
841
1674
387
2376
767
1170
2198
1546
2204
1774
514
418
530
681
1289
303
2855
627
1895
1510
158
2041
106
1333
2459
1174
338
2503
2850
1533
2422
379
438
1621
1762
2847
1611
876
2367...

output:

0
0
0
369098752
0
909674220
604516332
801560436
125002508
0
773697960
702866580
660652032
879490884
0
409700108
0
347297072
0
0
0
335862212
702905392
0
843621272
0
291503144
0
697181712
1009132420
451705880
640283228
720828004
715334144
409863584
529408912
0
0
0
0
0
0
698575380
790582388
0
952537528...

result:

ok 3000 tokens

Test #32:

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

input:

3000 387420489
1039
1400
2823
2477
784
1559
1421
99
227
2403
1183
391
2599
1213
2312
846
2697
629
1101
453
2887
1069
184
2973
356
1120
1473
2617
948
1710
118
195
2437
1393
329
1979
1303
1618
2417
1796
2220
2569
183
2946
701
2295
2304
1779
2123
1074
1858
1211
2910
2613
990
2463
1714
1947
2669
1358
24...

output:

0
293740053
125281446
345646179
0
194295114
292480203
322594425
183644082
68736654
0
0
0
0
333596370
379536885
79170288
143593923
156632097
29901360
0
0
0
306828138
234072231
0
100823361
0
37541094
383655114
0
78706734
0
0
361307949
85597221
0
0
251625003
124371708
44984316
0
243920181
18921165
2868...

result:

ok 3000 tokens

Test #33:

score: 0
Accepted
time: 364ms
memory: 38296kb

input:

3000 244140625
2540
2861
2495
402
992
2857
1243
2485
669
973
44
1253
1459
1541
2587
1218
328
1487
1913
1638
852
1363
1769
1545
2052
2072
1719
2745
2799
2578
322
1049
892
2640
2081
19
1254
2711
548
2590
206
2585
426
531
2164
498
1245
536
446
1488
921
888
2168
768
1251
1499
2962
464
2907
1197
1902
290...

output:

217179375
155158040
180000350
0
0
0
153069363
225005050
25782940
222709353
197971170
165366878
112790390
87999110
0
77769438
79404953
0
216667183
15319058
0
40795558
224639115
141937150
0
0
205182785
26246525
133889095
210489078
0
46820030
0
39432625
189417295
104989885
12438690
33095690
106894153
9...

result:

ok 3000 tokens

Test #34:

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

input:

3000 282475249
2827
1111
1872
2242
1327
1840
1560
405
965
2737
2699
2910
2406
64
1046
932
60
28
1529
2517
1769
2626
2945
490
2720
1861
1524
2900
2849
803
2371
688
1666
508
2646
2075
877
706
2637
1958
2163
481
2956
2226
1424
1201
1589
2641
2916
1160
2556
1338
343
1972
354
1413
2278
544
2665
1877
340
...

output:

256005447
64912855
0
8256353
29989775
40619175
164519618
160592071
18494867
195534171
41033689
254974181
94000809
80710945
0
50895271
257744512
50204560
0
268587659
238939211
119702408
235572372
250952569
16411539
178335708
249084927
171402784
10075275
129473428
146541381
27116894
234557218
20262709...

result:

ok 3000 tokens

Test #35:

score: 0
Accepted
time: 360ms
memory: 37840kb

input:

3000 214358881
704
2194
471
2528
2020
565
890
169
2839
1809
102
2616
2705
831
1292
1548
2272
1812
379
2378
1044
997
1536
2156
2786
333
1591
2505
393
1021
183
801
1407
1452
1045
2062
2733
2809
2832
2039
2687
270
980
339
1745
2450
856
686
1613
463
2565
2894
215
2527
2149
1994
759
1687
1432
962
53
1238...

output:

190435542
0
120953013
179148522
79813257
188319445
137155813
51278354
69496636
0
187535165
52823930
100849158
54308769
0
209941646
70064047
15460948
0
199076537
212681749
80482132
10322903
205859038
210233637
189126743
121130419
143276536
117481146
90601582
163601043
129152061
121937242
64345985
439...

result:

ok 3000 tokens

Test #36:

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

input:

3000 815730721
1258
722
30
821
1182
1312
2152
572
832
694
2811
11
2738
124
2155
1885
232
1163
227
2232
216
1315
2406
2175
2221
967
2750
1777
251
281
353
2980
717
2467
2915
1402
596
1041
1419
569
341
1272
2061
968
2762
554
1186
1116
650
150
545
2190
752
904
2148
2544
848
546
896
772
2827
34
120
2960
...

output:

414979783
369402195
621222647
92625910
811216103
105468295
758200644
473615792
13302601
550547247
423554849
72156886
99222418
53866611
492900749
159572192
494278258
0
0
337282412
504215321
305400303
241117825
290307117
757597286
86392407
593979873
558204384
349203455
167950920
691210988
164160910
78...

result:

ok 3000 tokens

Test #37:

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

input:

3000 410338673
1150
2205
323
1987
809
2924
961
1627
1231
1496
2910
2877
1243
2692
1972
1912
1958
2217
1205
2998
277
2971
859
1609
2638
1550
1386
1663
1031
2093
1677
775
1199
778
1295
1277
791
1669
1012
215
2834
2937
331
340
238
2187
671
1810
913
929
2836
2324
1244
1824
2553
787
291
2327
476
1580
117...

output:

242522320
279976290
11946682
123345022
25675128
31771504
378664467
250924802
319546956
275020492
290805860
204285734
377119806
400936755
96692753
0
33560498
145500905
332595292
32948822
192760803
183883758
380061544
241586384
79120602
287232239
231160125
337936742
175338604
253913122
55420611
235876...

result:

ok 3000 tokens

Test #38:

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

input:

3000 893871739
143
391
1194
2293
87
176
1467
2578
2016
2825
946
286
1116
59
2853
784
739
1329
2592
1874
1221
2332
2932
2527
2201
1722
1216
1742
2969
497
1973
2907
2956
2270
452
463
1698
2463
2651
1179
1476
2704
1334
594
1354
1572
1121
1416
1450
2919
89
959
880
350
2254
1321
2856
177
1589
702
1866
19...

output:

21069254
169198209
803696090
244205693
152204983
62906810
330946723
400167423
425790513
834489611
267887931
234549699
818142472
210305851
132654480
548757820
281952714
76082580
729227100
27251139
360673524
90738690
408960826
514668314
789141484
87323593
98116076
501638670
787438296
312111338
1339471...

result:

ok 3000 tokens

Test #39:

score: 0
Accepted
time: 364ms
memory: 39024kb

input:

3000 1
1216
289
1198
1839
2399
2615
2573
1961
1428
1395
2841
2514
2297
2349
2564
2474
2402
1877
121
2545
1611
198
131
2966
1844
981
356
1809
2560
1276
2848
229
2715
1551
2471
1933
1583
2342
2760
2077
1768
540
2455
2015
768
1414
987
1626
1292
951
2963
2461
2008
2047
1952
1724
2039
2371
939
2436
589
3...

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 3000 tokens

Test #40:

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

input:

3000 972405000
114
970
1302
1830
2666
1609
1472
1466
1291
2548
1108
1801
1949
2397
2218
1238
2775
868
211
568
2960
1722
1891
638
1025
2999
1414
201
2685
1982
1245
409
193
2375
1692
299
212
213
937
714
2671
926
1616
799
458
2141
771
510
1526
2464
1074
404
1545
1655
873
2169
541
165
2166
1527
2309
234...

output:

576357600
494116200
850237500
232656900
126107640
749716560
884940000
32269440
108909360
756539028
47040588
677905200
505362480
720300000
323582688
270724308
849954000
771212988
643159440
59457888
443580600
194460000
454892760
601930308
914781000
295611120
787959900
16627800
957577800
933502500
4274...

result:

ok 3000 tokens

Test #41:

score: 0
Accepted
time: 360ms
memory: 38792kb

input:

3000 1073217479
1998
480
424
36
2266
133
1539
2915
1483
1247
646
1849
2009
1026
177
1438
2010
2959
1980
2624
2909
2450
2297
306
1832
1140
1402
1318
2603
1657
70
1759
307
698
2459
2305
1664
906
141
249
2023
2820
1257
468
1948
2251
2773
1338
2049
1332
1384
1136
401
2142
1055
25
1662
1433
988
2866
2168...

output:

798335254
393895937
170044336
769077376
65976588
286250990
1027175365
387506142
725085029
725083996
921730779
563876455
586898124
933483842
268607586
992677457
46224922
614463476
169872048
62539735
682394234
102316980
143441008
503687516
838460382
7398587
748352624
763715817
971078003
405787497
6337...

result:

ok 3000 tokens

Test #42:

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

input:

3000 1072651369
326
1862
1957
2597
2540
2372
931
990
1568
1476
1478
2321
2480
238
1611
2950
2366
332
483
1839
840
2384
2133
2273
512
1846
2587
1046
2120
496
2667
2793
1695
2695
292
408
2643
954
2996
2715
101
2050
2278
1959
576
275
2533
940
2714
1789
66
606
493
529
230
1845
903
2648
2538
817
155
860
...

output:

258951222
634404982
455129954
998535495
1032061237
658593579
516324048
565347377
857961106
898037656
207074085
715234048
855902629
663392780
367234016
1038436618
278564577
19002609
376034986
1061401640
1056898057
836844976
551230471
830374050
318619018
166605281
417462653
591154525
527124293
2073245...

result:

ok 3000 tokens

Test #43:

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

input:

3000 1073741789
2968
2959
2968
2928
2941
2987
2986
2945
2965
2929
2982
2923
2933
2970
2991
2918
2991
2989
2950
2956
2907
2902
2929
2919
2977
2928
2943
2959
2963
2921
2935
2953
2960
2910
2977
2923
2982
2946
2929
2944
2994
2945
2930
2964
2961
2926
2905
2923
2941
2973
2998
2959
2982
2924
2941
2990
2982...

output:

594417640
505075971
594417640
288275280
314362210
582403152
965849531
652539241
834903057
865665032
806395917
821945173
496376059
232246394
1039899513
1026109978
1039899513
181585970
487709273
20945946
449240747
566001202
865665032
940851998
654001806
288275280
870835645
505075971
508759463
61465008...

result:

ok 3000 tokens

Test #44:

score: 0
Accepted
time: 360ms
memory: 37796kb

input:

3000 1073741783
2913
2986
2970
2901
2928
2993
2908
2932
2993
2939
2998
2964
2950
2905
2975
2916
2932
2980
2944
2952
2912
2916
2926
2992
2925
2988
2982
2963
2969
2965
2938
2910
2932
2929
2966
2914
2995
2915
2983
2983
2984
2965
2902
2995
2966
2958
2957
2986
2977
2972
2916
2921
2917
2967
2925
2970
2912...

output:

975578057
633364582
314792601
282862087
597685532
191740116
389019357
350247406
191740116
856855759
196038978
844985355
731895559
866913941
1048263099
731648679
350247406
965755588
197936103
479763381
559655824
731648679
965767092
456091584
952155320
603805885
84079524
989432099
33382642
719127966
4...

result:

ok 3000 tokens

Test #45:

score: 0
Accepted
time: 364ms
memory: 38220kb

input:

3000 1073741789
2883
632
1505
2426
1897
1549
889
2262
399
2774
2713
964
2875
1271
1397
1207
123
297
1343
1616
2472
2333
2639
2819
2268
2154
2328
2776
1680
2932
2008
256
855
1218
2622
1876
2809
2761
2344
520
1297
203
2182
216
992
821
2620
1366
215
2171
1418
1344
2997
126
2105
2012
2327
402
1874
11
10...

output:

611561749
186496986
188788200
422559342
168857376
140104299
309728790
401606510
46815904
114753767
921481232
574776162
931577091
595785570
763069179
860891195
235898026
136165796
862463835
603225003
863372856
728741292
216361538
318948429
978147348
149654163
486997341
9082212
918582013
541323385
413...

result:

ok 3000 tokens

Test #46:

score: 0
Accepted
time: 360ms
memory: 37752kb

input:

3000 1073741783
1227
2655
34
2864
2347
63
585
432
842
693
957
2262
225
1536
679
2277
2572
2629
2746
2961
1152
1434
2197
2634
342
2980
613
300
586
1069
711
2784
1100
2203
173
1545
942
1088
1975
658
2453
1717
1137
521
2531
1065
2045
1309
595
1698
1074
1794
1645
2190
1711
2245
2062
1810
968
1747
1610
1...

output:

781043624
605260580
960051274
482169958
765301440
133749987
932838482
817566343
266269191
229482512
672451745
828642148
123255028
471448209
103825108
119701930
479022502
743892058
741514295
403022964
83177247
764180362
1052756122
911328096
719098272
965755588
547023789
450378577
1006106825
704565150...

result:

ok 3000 tokens

Test #47:

score: 0
Accepted
time: 360ms
memory: 38068kb

input:

3000 1073741689
2335
204
866
85
1792
856
2889
2501
1673
1111
939
1163
282
840
1114
964
349
1314
2594
2846
2674
2732
1782
1953
1020
786
1615
71
1446
2086
2389
2090
1055
2566
274
996
590
1642
2990
112
335
618
1176
2828
2868
2425
2450
1991
645
1396
2712
1653
1228
2196
2531
2850
890
1444
1822
1993
2684
...

output:

13124802
298940519
87760432
451195835
845333815
1055822796
934696233
495421871
916719473
880722177
837304421
65105998
777196985
322240669
318791629
848325975
508105740
461890644
575583265
345670619
38274061
892379669
742762076
389343433
332577479
920453201
13433464
661591028
736490775
664228498
5539...

result:

ok 3000 tokens

Test #48:

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

input:

3000 1073741441
1283
1735
60
2627
2587
1010
943
964
811
1463
737
1965
185
2173
201
362
308
1824
1011
2426
1568
2085
169
1893
277
2852
408
299
2448
357
2325
528
1137
247
2648
59
2148
338
2156
1689
1656
2676
2034
2637
1071
1154
1115
381
347
2795
1708
316
334
670
2673
1915
1003
2864
32
925
2807
2045
21...

output:

636575502
204613910
178528777
282743278
46057701
710266493
67173886
884724534
202408532
754324731
793987576
422534690
397277658
613561167
887983152
575781532
690691749
281602379
585046753
642599365
902286222
264419969
760175461
683654582
910760796
897045319
348182108
670074939
1049270373
102885593
3...

result:

ok 3000 tokens

Test #49:

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

input:

3000 1073741329
2905
2954
1462
2264
193
1613
1798
1570
2782
1354
192
2548
744
1888
1095
38
1369
706
2145
1013
2999
578
1744
987
1326
1550
1485
786
1312
942
2903
22
2748
660
284
2357
2960
729
2271
1663
2430
887
1533
2880
1334
1522
1810
2964
1571
2106
683
133
1058
2656
799
2683
1270
2033
619
1009
53
2...

output:

48324294
963590385
791941786
682317555
968043398
212473683
373306173
484443441
117615383
814778895
237802094
219901211
790671515
645528676
861767451
686675774
295164328
686220813
275575368
159576152
386310900
396550656
74551732
1070882348
202619865
243497508
2153423
837336097
434275838
1058508966
81...

result:

ok 3000 tokens

Test #50:

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

input:

3000 1073740609
1319
1241
2510
1299
2057
1046
1936
2369
2416
2336
750
1369
884
220
2743
339
2779
1143
1717
114
21
840
1029
2305
2998
1579
47
2252
1584
502
722
642
1470
1106
673
173
2646
713
1629
1371
2175
2939
2729
1865
524
2376
2574
1548
1968
445
138
2658
151
1728
2444
1583
1507
1564
1586
470
2621
...

output:

24057945
1025021899
187416873
319019817
705589009
34638359
927592412
48856517
414724702
655287584
588908673
113445081
137542865
940824469
847354352
452892335
851294945
1036910978
143694651
900204640
1058632179
173833233
521625658
141564960
784516109
13916602
46803011
910178271
180031977
306464480
57...

result:

ok 3000 tokens

Test #51:

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

input:

3000 1073739937
2467
689
720
560
2869
2604
2486
331
2129
4
2403
1153
628
2006
987
1255
1552
1770
250
1823
2350
173
1844
2121
326
1836
762
760
2753
1627
580
2603
1544
104
2188
2569
2238
1829
1736
84
650
1538
2543
1858
2678
25
1474
1315
1553
1961
914
253
2542
1646
1862
1827
131
546
1919
1135
2683
2742...

output:

879354542
246156311
184114414
707341242
226451157
202176555
475261657
923895269
320907288
60
254381078
99920580
210256839
131608758
635301539
770322295
350555394
398306194
1016849515
897979415
1015693250
894930033
65405554
444075217
143225049
386014500
656406056
940139031
217321221
921012517
7325272...

result:

ok 3000 tokens

Test #52:

score: 0
Accepted
time: 364ms
memory: 38552kb

input:

3000 1073738753
229
567
282
2799
2934
482
2991
1827
2363
1466
360
1597
865
2265
2565
2031
1955
1233
2852
2834
2807
2024
2594
2358
967
476
1935
2137
345
2516
560
1020
1520
140
1183
1394
2849
1747
1024
796
2967
2697
1833
1348
851
2342
29
2403
1725
2771
1558
365
2917
1214
1973
835
1826
703
2163
781
222...

output:

782789593
335583260
403039596
646415992
883389631
1039795896
1055160000
28707603
853413562
1058825362
1060239834
1019388032
336855236
611207206
211762945
244071230
963539266
969600915
1026432540
615081690
26608447
7003412
997823900
627969264
207039380
343377771
546037388
851726058
572474571
64539689...

result:

ok 3000 tokens

Test #53:

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

input:

3000 1073736449
58
345
548
635
2739
1676
369
2594
2679
2683
593
2479
2118
2030
1807
1757
859
1919
527
2214
465
1193
2747
2608
257
172
1154
2693
1285
1279
2373
578
1777
2324
2302
1840
1701
1078
1067
2011
1172
1893
280
1545
312
585
304
974
2531
2652
97
1610
1431
816
2614
90
472
1021
86
1558
2069
2744
...

output:

551647940
24277290
655050996
715777760
746187131
520370976
181683112
744181058
563968853
512253753
46541869
110412982
549321699
380646994
787428337
288512356
1033006725
189285899
504018477
621393988
65102111
687704153
1018722402
806038401
8631470
942122978
515576698
225348637
699716994
72365506
7118...

result:

ok 3000 tokens

Test #54:

score: 0
Accepted
time: 365ms
memory: 37724kb

input:

3000 1073731073
2248
493
370
1806
1357
1099
1635
883
2670
668
1066
2779
2386
111
2103
2095
1914
2075
1557
617
1723
2857
2216
449
368
1052
2539
622
2361
472
319
1238
2246
1185
475
945
153
373
511
1724
1863
881
941
1655
2624
504
870
2897
188
1093
2665
2961
2294
2284
1807
469
2924
1738
1976
2810
2685
6...

output:

160809669
806052976
358293741
806463650
841638719
340891731
340878444
925993838
1008196542
271099522
758328498
126123447
781850084
354484431
911300958
461275428
706142878
803996628
1069955677
483032973
513634195
691256602
877067092
298457039
408179680
766018274
298690406
601571472
65868028
319282825...

result:

ok 3000 tokens

Test #55:

score: 0
Accepted
time: 364ms
memory: 38152kb

input:

3000 1073707009
1746
1247
32
1430
11
820
1227
336
672
1538
2511
2613
2816
1454
2740
104
1379
2034
290
1368
2468
122
1695
258
1221
720
2366
726
2270
173
1998
904
2502
2955
442
813
1897
2742
1585
1819
2216
1921
145
1400
2585
2957
1922
2663
1749
2490
774
1950
172
420
2989
1497
2419
1821
2596
993
245
71...

output:

92539097
928171222
51520240
358222403
265646860
307386056
443782507
616370097
840226381
373814693
56509884
905174719
562406674
757112727
218676376
201590841
948266007
540103628
530726384
331140821
794488991
414613575
239082435
699781136
538730077
902458194
224443559
499232746
1036810207
929869581
84...

result:

ok 3000 tokens