QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864058#8804. Treasure Huntlfxxx25 ✓991ms86244kbC++141.1kb2025-01-20 09:44:492025-01-20 09:44:51

Judging History

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

  • [2025-01-20 09:44:51]
  • 评测
  • 测评结果:25
  • 用时:991ms
  • 内存:86244kb
  • [2025-01-20 09:44:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 1e6 + 5;
int n, m, a[N];
ll d[N];
bool vis[N];
vector<pii>e[N];
void solve()
{
	priority_queue<pii>q;
	for (int i = 1; i <= n; ++i) q.emplace(d[i], i);
	while (!q.empty()) {
		int u = q.top().second;
		q.pop();
		if (vis[u]) continue;
		vis[u] = 1;
		for (auto [v, w] : e[u]) {
			if (d[v] < d[u] - w) {
				q.emplace(d[v] = d[u] - w, v);
			}
		}
	}
}
bool en;
int main()
{
#ifdef IAKIOI
	cerr << (&be - &en) / 1024.0 / 1024 << " MB\n----------------------------" << endl;
	freopen("in.in", "r", stdin);
	// freopen("out.out", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> m;
	for (int i = 1; i <= n; ++i) cin >> a[i], d[i] = a[i];
	for (int i = 1; i <= m; ++i) {
		int u, v, w;
		cin >> u >> v >> w;
		e[u].emplace_back(v, w);
		e[v].emplace_back(u, w);
	}
	solve();
	for (int i = 1; i <= n; ++i) cout << d[i] << '\n';
	return 0;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 6ms
memory: 31672kb

input:

3000 3000
735362183 321648408 84435611 638030501 876390252 836223236 65247387 527734646 80970666 766403495 110657364 283475781 693285991 945447633 641155308 132890294 969038868 372617561 823982498 896717651 845481436 111374342 404588333 709818617 665021093 770870148 892408756 925221803 884526087 620...

output:

735362183
713607491
748793363
638030501
876390252
836223236
824664802
606295597
80970666
766403495
110657364
506742426
693285991
945447633
641155308
365329924
969038868
372617561
823982498
896717651
845481436
239161696
404588333
709818617
665021093
770870148
892408756
925221803
884526087
620849020
4...

result:

ok 3000 lines

Test #2:

score: 5
Accepted
time: 5ms
memory: 31996kb

input:

3000 3000
972166434 659979142 344453258 395615030 984580008 713698299 329234177 681387709 35749436 498013633 220323044 838758786 923230288 22789609 51100137 72217062 885300626 948320992 132324930 312694252 176178575 402178209 741891771 522780632 408427186 105944768 787335363 218283387 849372992 5957...

output:

972166434
659979142
344453258
395615030
984580008
713698299
530975034
681387709
35749436
498013633
751022649
838758786
923230288
726365962
649403959
463998322
885300626
948320992
524349273
312694252
210337883
402178209
741891771
522780632
617934022
285654027
787335363
319154448
849372992
595755284
5...

result:

ok 3000 lines

Test #3:

score: 5
Accepted
time: 4ms
memory: 30916kb

input:

2000 3000
89876544 891255474 713979450 673065048 959236666 891228417 823405883 753035428 482478944 549110878 713746013 765809948 625394351 540810211 138742853 783651116 702745446 409263449 264555022 816159076 52123129 217641066 839925219 574406717 62302724 439732057 489026494 910128266 443257992 284...

output:

287183883
891255474
713979450
673065048
959236666
891228417
823405883
753035428
482478944
549110878
713746013
765809948
969087262
679664735
138742853
783651116
702745446
409263449
264555022
816159076
193516777
662862609
839925219
591556952
817074001
439732057
489026494
910128266
443257992
495558697
...

result:

ok 2000 lines

Test #4:

score: 5
Accepted
time: 4ms
memory: 31264kb

input:

2500 3000
0 1000000000 1000000000 0 1000000000 0 0 0 1000000000 0 0 1000000000 1000000000 1000000000 1000000000 0 1000000000 1000000000 0 1000000000 0 1000000000 1000000000 1000000000 0 0 0 0 0 1000000000 1000000000 0 1000000000 1000000000 0 0 1000000000 1000000000 0 0 1000000000 1000000000 0 0 1000...

output:

942200830
1000000000
1000000000
981175572
1000000000
757267853
899967379
942714211
1000000000
968845504
983558248
1000000000
1000000000
1000000000
1000000000
909088479
1000000000
1000000000
993668068
1000000000
977419757
1000000000
1000000000
1000000000
922529645
914574859
834950123
949162003
984312...

result:

ok 2500 lines

Test #5:

score: 5
Accepted
time: 2ms
memory: 32112kb

input:

1 0
321300751

output:

321300751

result:

ok single line: '321300751'

Test #6:

score: 5
Accepted
time: 3ms
memory: 30700kb

input:

2 1
853072294 184328520
2 1 851046910

output:

853072294
184328520

result:

ok 2 lines

Test #7:

score: 5
Accepted
time: 3ms
memory: 32020kb

input:

2 1
675815113 47008633
2 1 6

output:

675815113
675815107

result:

ok 2 lines

Test #8:

score: 5
Accepted
time: 4ms
memory: 30936kb

input:

2500 3000
379463792 434038125 450232165 663119022 929634691 447981861 727168756 29268678 101836976 59313172 163410609 911233882 271997950 792478625 498842948 39299739 765233121 649993425 224429598 273261981 60031711 640196758 459418686 462647695 127051736 729475488 214312090 325910804 917313496 2862...

output:

547193069
440194410
450232165
663119022
929634691
447981861
727168756
271856431
248749749
594252697
503284922
911233882
428729760
792478625
730703326
772883484
765233121
649993425
811011354
675845739
60031711
640196758
459418686
462647695
151284835
729475488
473808304
325910804
917313496
534753256
8...

result:

ok 2500 lines

Test #9:

score: 5
Accepted
time: 7ms
memory: 31832kb

input:

2900 3000
907239320 296718238 746129428 645601748 535695129 920479272 516307753 100916397 548566484 110410418 656833578 206881262 269129306 679095446 176420246 750733793 582677942 110935882 356659690 850355733 641008975 792096104 926048354 809241072 780927275 63262777 916003222 649159463 879794716 2...

output:

938028985
922240406
956341467
941286153
954230202
928107144
934466597
973400247
956549385
969018793
961798979
983602183
955618729
981158657
970897143
958170867
961500391
939199249
973819296
945862595
958847551
968684454
964831858
991882039
930429549
953277068
970182637
981209637
957331204
959350195
...

result:

ok 2900 lines

Test #10:

score: 5
Accepted
time: 3ms
memory: 32272kb

input:

2999 3000
439010862 3645191 79776002 771782497 348917593 166550553 411698322 885973241 798312546 547053265 61466548 467196975 867669823 387841203 996430494 321464341 203972407 686639313 370034831 192703406 971706114 377867262 968384499 327235794 524333368 398337398 105897120 942221048 771012693 2449...

output:

838630177
766463608
771992302
771782497
736709507
768325886
791363796
885973241
987577202
898829426
841532524
934046211
867669823
802901352
996430494
786451689
869847652
820256860
810593013
809367366
971706114
993070845
968384499
857619845
775779138
890414804
858374280
942221048
881426821
591166009
...

result:

ok 2999 lines

Test #11:

score: 5
Accepted
time: 3ms
memory: 31580kb

input:

78 3000
261753681 571358012 80705973 49232514 323574252 344080671 569433539 252588251 950074762 303183218 964954934 689215428 569833886 274458024 42604012 327865686 947788301 147581770 502264923 769797158 184087157 824733900 66417946 42425390 473176198 732124687 512620959 634065926 733493913 2288113...

output:

957872045
941317803
923248410
928079951
919143835
925045585
955227739
919862587
950074762
912140358
964954934
910667899
961985075
947768113
934453336
956108913
947788301
951023126
928002673
926483044
934246878
952546437
954247154
937144277
909846779
923686351
965431007
920535934
952567447
920846824
...

result:

ok 78 lines

Test #12:

score: 5
Accepted
time: 4ms
memory: 30460kb

input:

2251 3000
1000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

1000000000
999999999
999999000
999999998
999999997
999998998
999999996
999999995
999998996
999999994
999999993
999998994
999999992
999999991
999998992
999999990
999999989
999998990
999999988
999999987
999998988
999999986
999999985
999998986
999999984
999999983
999998984
999999982
999999981
999998982...

result:

ok 2251 lines

Test #13:

score: 5
Accepted
time: 3ms
memory: 31504kb

input:

59 87
1000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 2 1
2 3 1
1 3 536870912
3 4 1
4 5 1
3 5 268435456
5 6 1
6 7 1
5 7 134217728
7 8 1
8 9 1
7 9 67108864
9 10 1
10 11 1
9 11 33554432
11 12 1
12 13 1
11 13 16777216
13 1...

output:

1000000000
999999999
999999998
999999997
999999996
999999995
999999994
999999993
999999992
999999991
999999990
999999989
999999988
999999987
999999986
999999985
999999984
999999983
999999982
999999981
999999980
999999979
999999978
999999977
999999976
999999975
999999974
999999973
999999972
999999971...

result:

ok 59 lines

Subtask #2:

score: 5
Accepted

Test #14:

score: 5
Accepted
time: 991ms
memory: 86144kb

input:

1000000 1000000
735362183 321648408 84435611 638030501 876390252 836223236 65247387 527734646 80970666 766403495 110657364 283475781 693285991 945447633 641155308 132890294 969038868 372617561 823982498 896717651 845481436 111374342 404588333 709818617 665021093 770870148 892408756 925221803 8845260...

output:

999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999133
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
999999337
...

result:

ok 1000000 lines

Test #15:

score: 5
Accepted
time: 912ms
memory: 86220kb

input:

1000000 1000000
972166434 659979142 344453258 395615030 984580008 713698299 329234177 681387709 35749436 498013633 220323044 838758786 923230288 22789609 51100137 72217062 885300626 948320992 132324930 312694252 176178575 402178209 741891771 522780632 408427186 105944768 787335363 218283387 84937299...

output:

999997942
999997942
999995686
999997942
999992603
999991479
999991479
999988091
999969268
999997942
999997942
999873914
999873914
999997942
999992603
999998618
999997942
999998618
999949443
999992603
999992603
999997942
999990149
999992603
999998618
999997942
999998618
999992603
997438334
999995686
...

result:

ok 1000000 lines

Test #16:

score: 5
Accepted
time: 961ms
memory: 86196kb

input:

1000000 1000000
89876544 891255474 713979450 673065048 959236666 891228417 823405883 753035428 482478944 549110878 713746013 765809948 625394351 540810211 138742853 783651116 702745446 409263449 264555022 816159076 52123129 217641066 839925219 574406717 62302724 439732057 489026494 910128266 4432579...

output:

997108218
999999932
999999932
999963490
999999932
999999932
999999932
999992441
999999932
999999932
999999932
999999932
999999932
999999932
999963490
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
999999932
...

result:

ok 1000000 lines

Test #17:

score: 5
Accepted
time: 892ms
memory: 86168kb

input:

1000000 1000000
793525224 909688747 750789037 511849752 431764007 885119246 464824109 742677803 199820823 34793356 991685 318127360 799778183 278171072 862614259 267192454 642711694 428317910 810607357 480741050 514784297 820570476 698688676 191823894 921615000 435795527 702514858 632160218 62471189...

output:

999996535
999996535
999996535
999996535
999883720
999970342
999996535
999996535
999996535
999996535
999993870
999996535
999996535
999996535
999970342
999887305
999996535
999883720
999951943
999887305
999996535
999996535
999993870
999996535
999951943
999996535
999996535
999996535
999996535
999996535
...

result:

ok 1000000 lines

Test #18:

score: 5
Accepted
time: 885ms
memory: 85744kb

input:

900000 1000000
321300751 140965078 415282520 789299771 37824446 694053144 327592034 814325522 646550331 790923311 199447361 245178522 501942247 164787893 908787778 610030288 91560294 889260368 942837448 689238582 390728851 931000625 165318343 907013491 870457830 64550108 404205989 324005097 88216040...

output:

999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
999999023
...

result:

ok 900000 lines

Test #19:

score: 5
Accepted
time: 956ms
memory: 85556kb

input:

900000 1000000
853072294 184328520 380332875 620513228 851046910 645157134 222982604 599382365 896296393 522533449 309113041 800461527 395450055 168500942 23765315 844324348 376418272 169996506 251179881 400182475 426458699 926837200 502621781 425008213 318896631 104657437 594099887 617066681 847007...

output:

999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
999999090
...

result:

ok 900000 lines

Test #20:

score: 5
Accepted
time: 864ms
memory: 84764kb

input:

800000 1000000
675815113 47008633 749859066 529367026 457107349 412621836 380717820 671030084 48058608 278663402 507568717 727512688 392581410 55117763 774971543 555758401 825266873 630938964 678377265 608680007 302403253 373703837 600655228 140197809 972772170 438444726 295791018 235282631 73585959...

output:

999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
999998506
...

result:

ok 800000 lines

Test #21:

score: 5
Accepted
time: 922ms
memory: 84996kb

input:

800000 1000000
379463792 434038125 450232165 663119022 929634691 447981861 727168756 29268678 101836976 59313172 163410609 911233882 271997950 792478625 498842948 39299739 765233121 649993425 224429598 273261981 60031711 640196758 459418686 462647695 127051736 729475488 214312090 325910804 917313496...

output:

999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
999999993
...

result:

ok 800000 lines

Test #22:

score: 5
Accepted
time: 803ms
memory: 83336kb

input:

700000 1000000
907239320 296718238 746129428 645601748 535695129 920479272 516307753 100916397 548566484 110410418 656833578 206881262 269129306 679095446 176420246 750733793 582677942 110935882 356659690 850355733 641008975 792096104 926048354 809241072 780927275 63262777 916003222 649159463 879794...

output:

999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
999999484
...

result:

ok 700000 lines

Test #23:

score: 5
Accepted
time: 852ms
memory: 83020kb

input:

700000 1000000
439010862 3645191 79776002 771782497 348917593 166550553 411698322 885973241 798312546 547053265 61466548 467196975 867669823 387841203 996430494 321464341 203972407 686639313 370034831 192703406 971706114 377867262 968384499 327235794 524333368 398337398 105897120 942221048 771012693...

output:

999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
999999895
...

result:

ok 700000 lines

Test #24:

score: 5
Accepted
time: 758ms
memory: 82124kb

input:

600000 1000000
261753681 571358012 80705973 49232514 323574252 344080671 569433539 252588251 950074762 303183218 964954934 689215428 569833886 274458024 42604012 327865686 947788301 147581770 502264923 769797158 184087157 824733900 66417946 42425390 473176198 732124687 512620959 634065926 733493913 ...

output:

999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
999998388
...

result:

ok 600000 lines

Test #25:

score: 5
Accepted
time: 786ms
memory: 80588kb

input:

600000 1000000
670435069 958387505 486111781 519420999 91068885 379440697 620917183 610826846 593787714 378800280 547167898 872936622 375621498 11818885 766475417 516439732 592787256 830199743 48317257 434379132 310311835 796259529 925181405 364875276 963892254 23155448 652480396 356097878 914947811...

output:

999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
999998670
...

result:

ok 600000 lines

Test #26:

score: 5
Accepted
time: 699ms
memory: 80036kb

input:

500000 1000000
788145180 821067617 150605263 501903726 697129324 146905398 705023471 682474565 745549929 839962943 745623574 799987784 446381782 898435707 149085424 522841077 705199369 627578689 401885713 937843956 891289099 243126166 391811071 80064872 617767792 356942738 59204234 47942756 80380010...

output:

999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
999999780
...

result:

ok 500000 lines

Test #27:

score: 5
Accepted
time: 730ms
memory: 79052kb

input:

500000 1000000
24949430 159398350 115655618 628084475 510351788 98009389 674042969 467531408 995295992 571573080 855289254 428899715 971293370 902148756 632659182 462167845 31526542 908314829 488889782 58853265 221986237 533930033 24081800 229463376 729770105 397050067 322727061 341004341 768647008 ...

output:

999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
999997869
...

result:

ok 500000 lines

Test #28:

score: 5
Accepted
time: 456ms
memory: 62176kb

input:

100000 1000000
142659541 390674683 116585590 610567201 821444935 201910579 463181966 244211835 147058206 327703034 348712222 355950877 378490142 788765577 310236481 805005679 143938655 369257285 916087166 857285381 434367281 980796672 122115248 944652972 383645643 394400867 319385484 959220292 26095...

output:

999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
999968007
...

result:

ok 100000 lines

Test #29:

score: 5
Accepted
time: 457ms
memory: 60992kb

input:

100000 1000000
568865091 730166999 612860152 640405281 246687348 121584827 742583880 383352352 67645743 280790497 819849264 804580951 470839076 960131405 40757565 627994394 251442922 730005753 626398020 117380443 631979898 376693109 190005917 90751404 852962119 820137868 512124913 80468896 488830881...

output:

999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
999986582
...

result:

ok 100000 lines

Subtask #3:

score: 7
Accepted

Test #30:

score: 7
Accepted
time: 893ms
memory: 85996kb

input:

1000000 999999
735362183 321648408 84435611 638030501 876390252 836223236 65247387 527734646 80970666 766403495 110657364 283475781 693285991 945447633 641155308 132890294 969038868 372617561 823982498 896717651 845481436 111374342 404588333 709818617 665021093 770870148 892408756 925221803 88452608...

output:

979609066
702859432
576832877
638030501
876390252
836223236
126385211
527734646
417361042
766403495
480327161
283475781
693285991
945447633
641155308
132890294
969038868
791035638
823982498
896717651
845481436
286394882
443330763
709818617
665021093
770870148
892408756
925221803
884526087
620849020
...

result:

ok 1000000 lines

Test #31:

score: 7
Accepted
time: 955ms
memory: 86192kb

input:

1000000 999999
972166434 659979142 344453258 395615030 984580008 713698299 329234177 681387709 35749436 498013633 220323044 838758786 923230288 22789609 51100137 72217062 885300626 948320992 132324930 312694252 176178575 402178209 741891771 522780632 408427186 105944768 787335363 218283387 849372992...

output:

972166434
716487202
344453258
395615030
984580008
713698299
329234177
681387709
352690901
498013633
220323044
838758786
923230288
22789609
94975195
416007345
885300626
948320992
643329880
370496671
301717719
419976516
741891771
522780632
408427186
265069776
787335363
218283387
849372992
595755284
69...

result:

ok 1000000 lines

Test #32:

score: 7
Accepted
time: 853ms
memory: 86028kb

input:

1000000 999999
89876544 891255474 713979450 673065048 959236666 891228417 823405883 753035428 482478944 549110878 713746013 765809948 625394351 540810211 138742853 783651116 702745446 409263449 264555022 816159076 52123129 217641066 839925219 574406717 62302724 439732057 489026494 910128266 44325799...

output:

133211603
891255474
713979450
673065048
959236666
891228417
823405883
753035428
482478944
549110878
713746013
765809948
625394351
540810211
138742853
783651116
715704319
409263449
264555022
816159076
495850815
506470926
839925219
886912199
906252546
439732057
489026494
910128266
443257992
284609594
...

result:

ok 1000000 lines

Test #33:

score: 7
Accepted
time: 890ms
memory: 86212kb

input:

1000000 999999
793525224 909688747 750789037 511849752 431764007 885119246 464824109 742677803 199820823 34793356 991685 318127360 799778183 278171072 862614259 267192454 642711694 428317910 810607357 480741050 514784297 820570476 698688676 191823894 921615000 435795527 702514858 632160218 624711890...

output:

793525224
909688747
750789037
883087675
431764007
885119246
673930700
742677803
350414898
291663221
991685
336280807
799778183
278171072
862614259
669339308
642711694
428317910
810607357
480741050
514784297
820570476
698688676
191823894
921615000
435795527
702514858
632160218
624711890
277346536
570...

result:

ok 1000000 lines

Test #34:

score: 7
Accepted
time: 7ms
memory: 31696kb

input:

2 1
321300751 140965078
1 2 37824446

output:

321300751
283476305

result:

ok 2 lines

Test #35:

score: 7
Accepted
time: 4ms
memory: 31832kb

input:

1 0
853072294

output:

853072294

result:

ok single line: '853072294'

Test #36:

score: 7
Accepted
time: 969ms
memory: 86080kb

input:

1000000 999999
675815113 47008633 749859066 529367026 457107349 412621836 380717820 671030084 48058608 278663402 507568717 727512688 392581410 55117763 774971543 555758401 825266873 630938964 678377265 608680007 302403253 373703837 600655228 140197809 972772170 438444726 295791018 235282631 73585959...

output:

998856938
988677121
987455077
989792419
994203766
992014038
989713218
998391227
976937632
994411746
993213660
987005923
985342554
991722112
996034793
989333113
997384786
990500057
992529923
984186142
989636699
992806704
984870751
980601208
987877077
995195408
986816483
990943267
997199085
987989712
...

result:

ok 1000000 lines

Test #37:

score: 7
Accepted
time: 939ms
memory: 86196kb

input:

1000000 999999
379463792 434038125 450232165 663119022 929634691 447981861 727168756 29268678 101836976 59313172 163410609 911233882 271997950 792478625 498842948 39299739 765233121 649993425 224429598 273261981 60031711 640196758 459418686 462647695 127051736 729475488 214312090 325910804 917313496...

output:

996825073
997955151
998922345
997514107
997563728
996084045
998660779
998992003
998944301
998360829
997010701
997554305
997344759
998132396
998479285
998276448
997902772
994712383
999440810
998571780
998634831
997595472
998263443
997753997
997862053
996201730
999049680
997348432
998933497
998613948
...

result:

ok 1000000 lines

Test #38:

score: 7
Accepted
time: 893ms
memory: 86200kb

input:

1000000 999999
907239320 296718238 746129428 645601748 535695129 920479272 516307753 100916397 548566484 110410418 656833578 206881262 269129306 679095446 176420246 750733793 582677942 110935882 356659690 850355733 641008975 792096104 926048354 809241072 780927275 63262777 916003222 649159463 879794...

output:

999995613
999995406
999995499
999994070
999992731
999991340
999994871
999992404
999997583
999994501
999997390
999991102
999993375
999995919
999995059
999993598
999995580
999995798
999995282
999994725
999993024
999995374
999995938
999996717
999992803
999993544
999995685
999996010
999994524
999997858
...

result:

ok 1000000 lines

Test #39:

score: 7
Accepted
time: 922ms
memory: 86244kb

input:

1000000 999999
439010862 3645191 79776002 771782497 348917593 166550553 411698322 885973241 798312546 547053265 61466548 467196975 867669823 387841203 996430494 321464341 203972407 686639313 370034831 192703406 971706114 377867262 968384499 327235794 524333368 398337398 105897120 942221048 771012693...

output:

999992645
999990173
999972193
999961805
999953597
999982103
999976735
999984060
999988196
999960349
999974862
999990216
999981370
999987917
999973942
999972666
999975189
999995126
999980301
999979568
999987790
999992684
999993360
999959720
999985600
999989154
999973322
999993067
999986308
999977775
...

result:

ok 1000000 lines

Test #40:

score: 7
Accepted
time: 5ms
memory: 30952kb

input:

100 99
261753681 571358012 80705973 49232514 323574252 344080671 569433539 252588251 950074762 303183218 964954934 689215428 569833886 274458024 42604012 327865686 947788301 147581770 502264923 769797158 184087157 824733900 66417946 42425390 473176198 732124687 512620959 634065926 733493913 22881134...

output:

261753681
571358012
439086222
307434792
826101496
344080671
626355559
560458603
950074762
449756129
964954934
689215428
569833886
274458024
42604012
327865686
947788301
213952260
502264923
769797158
295317703
824733900
508766351
42425390
473176198
732124687
512620959
634065926
733493913
228811344
72...

result:

ok 100 lines

Subtask #4:

score: 8
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #41:

score: 8
Accepted
time: 958ms
memory: 86184kb

input:

1000000 1000000
735362183 321648408 84435611 638030501 876390252 836223236 65247387 527734646 80970666 766403495 110657364 283475781 693285991 945447633 641155308 132890294 969038868 372617561 823982498 896717651 845481436 111374342 404588333 709818617 665021093 770870148 892408756 925221803 8845260...

output:

735362183
321648408
84435611
638030501
876390252
836223236
65247387
527734646
898447656
766403495
320347240
283475781
693285991
945447633
641155308
414707087
969038868
372617561
823982498
896717651
845481436
111374342
404588333
709818617
665021093
770870148
892408756
925221803
884526087
620849020
77...

result:

ok 1000000 lines

Test #42:

score: 8
Accepted
time: 881ms
memory: 86092kb

input:

1000000 1000000
972166434 659979142 344453258 395615030 984580008 713698299 329234177 681387709 35749436 498013633 220323044 838758786 923230288 22789609 51100137 72217062 885300626 948320992 132324930 312694252 176178575 402178209 741891771 522780632 408427186 105944768 787335363 218283387 84937299...

output:

972166434
659979142
381008646
395615030
984580008
713698299
545149412
681387709
35749436
498013633
220323044
838758786
923230288
194784442
243407935
105182991
885300626
948320992
132324930
355833270
206282518
402178209
741891771
646999042
408427186
249938438
787335363
603546396
849372992
595755284
5...

result:

ok 1000000 lines

Test #43:

score: 8
Accepted
time: 901ms
memory: 86072kb

input:

1000000 1000000
89876544 891255474 713979450 673065048 959236666 891228417 823405883 753035428 482478944 549110878 713746013 765809948 625394351 540810211 138742853 783651116 702745446 409263449 264555022 816159076 52123129 217641066 839925219 574406717 62302724 439732057 489026494 910128266 4432579...

output:

999998047
999995754
999997713
999997549
999997447
999997222
999998225
999998474
999996617
999997802
999996929
999996081
999998653
999995889
999998457
999998589
999997253
999996805
999997508
999995131
999997596
999996452
999995666
999998047
999997961
999998495
999997255
999994445
999996207
999998534
...

result:

ok 1000000 lines

Test #44:

score: 8
Accepted
time: 898ms
memory: 86216kb

input:

1000000 1000000
793525224 909688747 750789037 511849752 431764007 885119246 464824109 742677803 199820823 34793356 991685 318127360 799778183 278171072 862614259 267192454 642711694 428317910 810607357 480741050 514784297 820570476 698688676 191823894 921615000 435795527 702514858 632160218 62471189...

output:

999962838
999983114
999974585
999990507
999954066
999960489
999976777
999961576
999963507
999981201
999985079
999967880
999973866
999960295
999957951
999952447
999983075
999952371
999964786
999954565
999955224
999969214
999987919
999964057
999964130
999957974
999977202
999953781
999963989
999983060
...

result:

ok 1000000 lines

Test #45:

score: 8
Accepted
time: 926ms
memory: 86088kb

input:

1000000 1000000
321300751 140965078 415282520 789299771 37824446 694053144 327592034 814325522 646550331 790923311 199447361 245178522 501942247 164787893 908787778 610030288 91560294 889260368 942837448 689238582 390728851 931000625 165318343 907013491 870457830 64550108 404205989 324005097 8821604...

output:

999813576
999898047
999894641
999930511
999783229
999833631
999899655
999960779
999879681
999899908
999813630
999840065
999888786
999848781
999922033
999913159
999807015
999871225
999934632
999863870
999848341
999826998
999958999
999913315
999929376
999870414
999809380
999896671
999889936
999844606
...

result:

ok 1000000 lines

Test #46:

score: 8
Accepted
time: 927ms
memory: 85552kb

input:

900000 1000000
853072294 184328520 380332875 620513228 851046910 645157134 222982604 599382365 896296393 522533449 309113041 800461527 395450055 168500942 23765315 844324348 376418272 169996506 251179881 400182475 426458699 926837200 502621781 425008213 318896631 104657437 594099887 617066681 847007...

output:

853072294
184328520
380332875
620513228
851046910
645157134
313768359
599382365
896296393
522533449
309113041
800461527
407762310
698238747
638812291
844324348
376418272
363194605
283488280
400182475
426458699
926837200
773084413
620612420
833529217
191832656
594099887
617066681
847007306
604670622
...

result:

ok 900000 lines

Test #47:

score: 8
Accepted
time: 951ms
memory: 85748kb

input:

900000 1000000
675815113 47008633 749859066 529367026 457107349 412621836 380717820 671030084 48058608 278663402 507568717 727512688 392581410 55117763 774971543 555758401 825266873 630938964 678377265 608680007 302403253 373703837 600655228 140197809 972772170 438444726 295791018 235282631 73585959...

output:

999997414
999997376
999997474
999997588
999997228
999997381
999997141
999997386
999997239
999997301
999997354
999997570
999997088
999997349
999997347
999997262
999997340
999997450
999997226
999997641
999997437
999997248
999997359
999997290
999997085
999997200
999997788
999997321
999997325
999997243
...

result:

ok 900000 lines

Test #48:

score: 8
Accepted
time: 805ms
memory: 85216kb

input:

800000 1000000
379463792 434038125 450232165 663119022 929634691 447981861 727168756 29268678 101836976 59313172 163410609 911233882 271997950 792478625 498842948 39299739 765233121 649993425 224429598 273261981 60031711 640196758 459418686 462647695 127051736 729475488 214312090 325910804 917313496...

output:

446355820
647542879
450232165
750762670
929634691
684923178
727168756
373016288
101836976
475445354
163410609
911233882
271997950
792478625
528204355
442756364
765233121
649993425
625075110
287406680
417586992
640196758
459418686
462647695
516415504
729475488
835459631
325910804
917313496
706862210
...

result:

ok 800000 lines

Test #49:

score: 8
Accepted
time: 884ms
memory: 85312kb

input:

800000 1000000
907239320 296718238 746129428 645601748 535695129 920479272 516307753 100916397 548566484 110410418 656833578 206881262 269129306 679095446 176420246 750733793 582677942 110935882 356659690 850355733 641008975 792096104 926048354 809241072 780927275 63262777 916003222 649159463 879794...

output:

999917041
999940970
999926680
999951029
999909397
999912926
999939510
999930815
999933710
999920075
999931440
999927756
999927982
999933039
999927819
999938397
999932187
999934819
999932042
999948767
999929559
999936496
999934722
999947128
999925241
999912345
999957509
999924276
999946247
999933229
...

result:

ok 800000 lines

Test #50:

score: 8
Accepted
time: 453ms
memory: 65184kb

input:

100000 1000000
439010862 3645191 79776002 771782497 348917593 166550553 411698322 885973241 798312546 547053265 61466548 467196975 867669823 387841203 996430494 321464341 203972407 686639313 370034831 192703406 971706114 377867262 968384499 327235794 524333368 398337398 105897120 942221048 771012693...

output:

999985602
999985609
999985626
999985634
999985627
999985616
999985623
999985591
999985631
999985606
999985616
999985614
999985613
999985617
999985617
999985616
999985621
999985601
999985606
999985607
999985626
999985616
999985608
999985609
999985627
999985619
999985630
999985623
999985612
999985628
...

result:

ok 100000 lines

Test #51:

score: 8
Accepted
time: 453ms
memory: 65536kb

input:

100000 1000000
261753681 571358012 80705973 49232514 323574252 344080671 569433539 252588251 950074762 303183218 964954934 689215428 569833886 274458024 42604012 327865686 947788301 147581770 502264923 769797158 184087157 824733900 66417946 42425390 473176198 732124687 512620959 634065926 733493913 ...

output:

999989308
999989308
999989308
999989307
999989307
999989308
999989308
999989308
999989308
999989308
999989308
999989307
999989308
999989307
999989308
999989308
999989308
999989308
999989308
999989308
999989308
999989308
999989308
999989307
999989306
999989306
999989308
999989308
999989307
999989306
...

result:

ok 100000 lines

Test #52:

score: 8
Accepted
time: 159ms
memory: 57156kb

input:

1500 1000000
670435069 958387505 486111781 519420999 91068885 379440697 620917183 610826846 593787714 378800280 547167898 872936622 375621498 11818885 766475417 516439732 592787256 830199743 48317257 434379132 310311835 796259529 925181405 364875276 963892254 23155448 652480396 356097878 914947811 9...

output:

994688485
993628255
991687160
993632571
992711517
994835850
989808706
992429296
995020273
994354435
992502546
993562406
992788026
995492478
994136219
992844710
992167930
993833646
992301828
994532928
994706684
993668365
993837068
994475242
992509392
995400297
996279096
993443004
994371128
994125720
...

result:

ok 1500 lines

Test #53:

score: 8
Accepted
time: 146ms
memory: 56416kb

input:

1500 1000000
788145180 821067617 150605263 501903726 697129324 146905398 705023471 682474565 745549929 839962943 745623574 799987784 446381782 898435707 149085424 522841077 705199369 627578689 401885713 937843956 891289099 243126166 391811071 80064872 617767792 356942738 59204234 47942756 803800103 ...

output:

999572409
999571982
999572591
999572512
999572400
999572545
999572690
999572408
999572776
999572455
999572688
999572438
999572478
999572735
999572515
999572454
999572519
999572555
999572470
999572679
999572463
999572544
999572170
999572703
999572401
999572344
999572392
999572652
999572538
999572531
...

result:

ok 1500 lines

Test #54:

score: 8
Accepted
time: 906ms
memory: 86232kb

input:

999999 1000000
24949430 159398350 115655618 628084475 510351788 98009389 674042969 467531408 995295992 571573080 855289254 428899715 971293370 902148756 632659182 462167845 31526542 908314829 488889782 58853265 221986237 533930033 24081800 229463376 729770105 397050067 322727061 341004341 768647008 ...

output:

999325511
999262050
999750185
999812103
999513594
999463881
999547716
999681214
999517152
999273004
999530142
999728763
999577801
999696147
999712280
999680582
999704181
999612660
999778334
999275519
999499719
999701982
999193491
999390335
999743016
999277777
999513343
999382394
999655321
999034809
...

result:

ok 999999 lines

Test #55:

score: 8
Accepted
time: 898ms
memory: 86216kb

input:

999999 1000000
142659541 390674683 116585590 610567201 821444935 201910579 463181966 244211835 147058206 327703034 348712222 355950877 378490142 788765577 310236481 805005679 143938655 369257285 916087166 857285381 434367281 980796672 122115248 944652972 383645643 394400867 319385484 959220292 26095...

output:

999918589
999881217
999907626
999907181
999794428
999827921
999824927
999939373
999932011
999878543
999866657
999946722
999844326
999866719
999941636
999937920
999836803
999907942
999925352
999876965
999862097
999742318
999878660
999899796
999876083
999882976
999890092
999889306
999910321
999938916
...

result:

ok 999999 lines

Test #56:

score: 8
Accepted
time: 321ms
memory: 76140kb

input:

750001 1000000
1000000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

1000000000
999999999
999999000
999999998
999999997
999998998
999999996
999999995
999998996
999999994
999999993
999998994
999999992
999999991
999998992
999999990
999999989
999998990
999999988
999999987
999998988
999999986
999999985
999998986
999999984
999999983
999998984
999999982
999999981
999998982...

result:

ok 750001 lines

Extra Test:

score: 0
Extra Test Passed