QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#838792#2536. Akcijaduckindog80 112ms5756kbC++231.1kb2024-12-31 22:45:232024-12-31 22:45:24

Judging History

This is the latest submission verdict.

  • [2024-12-31 22:45:24]
  • Judged
  • Verdict: 80
  • Time: 112ms
  • Memory: 5756kb
  • [2024-12-31 22:45:23]
  • Submitted

answer

#include<bits/stdc++.h>

using namespace std;

const int N = 2000 + 10;
int n, k;

struct Product { 
  int w, d;
  friend istream& operator >> (istream& is, Product& rhs) { 
    return is >> rhs.w >> rhs.d;
  }
} p[N];
multiset<pair<int, long long>> s[N];

int32_t main(){
	cin.tie(0)->sync_with_stdio(0);

  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> p[i];
  
  sort(p + 1, p + n + 1, [&](const auto& a, const auto& b) { 
    return a.d < b.d;
  });

  for (int i = 0; i <= n; ++i) s[i] = {{0, 0}};
  for (int i = 1; i <= n; ++i) { 
    const auto& [w, d] = p[i];

    for (int j = d; j >= 1; --j) { 
      for (const auto& [cnt, cost] : s[j - 1]) { 
        s[j].insert({cnt + 1, cost - w});
        if ((int)s[j].size() > k) s[j].erase(s[j].begin());
      }
    }
  }

  vector<pair<int, long long>> answer;
  for (int i = 1; i <= n; ++i)
    answer.insert(answer.end(), s[i].begin(), s[i].end());

  sort(answer.begin(), answer.end(), greater<>());
  for (int i = 0; i < k; ++i)
    cout << answer[i].first << " " << -answer[i].second << "\n";
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 44ms
memory: 3920kb

input:

1919 1
126746165 1373
126746165 1621
126746165 1157
126746165 1647
126746165 1046
126746165 1626
126746165 813
126746165 1197
126746165 1240
126746165 738
126746165 840
126746165 571
126746165 1712
126746165 109
126746165 1850
126746165 524
126746165 736
126746165 917
126746165 1520
126746165 1559
1...

output:

1893 239930490345

result:

ok single line: '1893 239930490345'

Test #2:

score: 10
Accepted
time: 51ms
memory: 4052kb

input:

2000 1
955444834 1441
955444834 1866
955444834 1
955444834 257
955444834 605
955444834 1999
955444834 294
955444834 473
955444834 185
955444834 794
955444834 373
955444834 776
955444834 692
955444834 1340
955444834 794
955444834 1872
955444834 1078
955444834 1693
955444834 839
955444834 627
95544483...

output:

1966 1878404543644

result:

ok single line: '1966 1878404543644'

Test #3:

score: 10
Accepted
time: 43ms
memory: 4108kb

input:

1837 1
404217733 48
404217733 1712
404217733 1010
404217733 1741
404217733 800
404217733 891
404217733 773
404217733 589
404217733 607
404217733 284
404217733 376
404217733 1284
404217733 1138
404217733 221
404217733 551
404217733 892
404217733 491
404217733 1163
404217733 1142
404217733 1504
404217...

output:

1772 716273822876

result:

ok single line: '1772 716273822876'

Test #4:

score: 10
Accepted
time: 43ms
memory: 4120kb

input:

1814 1
673960138 1285
673960138 1524
673960138 528
673960138 221
673960138 927
673960138 1033
673960138 1620
673960138 793
673960138 1626
673960138 35
673960138 228
673960138 74
673960138 376
673960138 450
673960138 94
673960138 170
673960138 800
673960138 1261
673960138 55
673960138 264
673960138 8...

output:

1795 1209758447710

result:

ok single line: '1795 1209758447710'

Test #5:

score: 10
Accepted
time: 51ms
memory: 3904kb

input:

1981 1
655754816 1085
655754816 343
655754816 1927
655754816 1695
655754816 1417
655754816 1207
655754816 1383
655754816 1184
655754816 429
655754816 281
655754816 1935
655754816 445
655754816 13
655754816 1384
655754816 502
655754816 1790
655754816 862
655754816 1254
655754816 1544
655754816 11
655...

output:

1951 1279377646016

result:

ok single line: '1951 1279377646016'

Test #6:

score: 10
Accepted
time: 1ms
memory: 4104kb

input:

1811 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
934941692 1
93494...

output:

1 934941692

result:

ok single line: '1 934941692'

Test #7:

score: 10
Accepted
time: 1ms
memory: 3920kb

input:

1990 1
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
356460601 5
35646...

output:

5 1782303005

result:

ok single line: '5 1782303005'

Test #8:

score: 10
Accepted
time: 1ms
memory: 4108kb

input:

1845 1
439788326 4
439788326 2
439788326 3
439788326 5
439788326 4
439788326 3
439788326 5
439788326 2
439788326 3
439788326 2
439788326 3
439788326 1
439788326 1
439788326 3
439788326 2
439788326 1
439788326 3
439788326 3
439788326 4
439788326 5
439788326 5
439788326 2
439788326 2
439788326 2
43978...

output:

5 2198941630

result:

ok single line: '5 2198941630'

Test #9:

score: 10
Accepted
time: 2ms
memory: 3916kb

input:

1802 1
332342588 41
332342588 11
332342588 37
332342588 16
332342588 23
332342588 35
332342588 10
332342588 18
332342588 1
332342588 26
332342588 19
332342588 33
332342588 17
332342588 17
332342588 22
332342588 37
332342588 21
332342588 39
332342588 24
332342588 7
332342588 23
332342588 30
332342588...

output:

42 13958388696

result:

ok single line: '42 13958388696'

Test #10:

score: 10
Accepted
time: 19ms
memory: 3844kb

input:

1873 1
613474075 936
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 936
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 1
613474075 936
613474075 1
613474075 936
613474075...

output:

923 566236571225

result:

ok single line: '923 566236571225'

Test #11:

score: 10
Accepted
time: 0ms
memory: 3652kb

input:

1 1
22282234 1

output:

1 22282234

result:

ok single line: '1 22282234'

Test #12:

score: 10
Accepted
time: 0ms
memory: 3628kb

input:

2 1
713738007 1
713738007 1

output:

1 713738007

result:

ok single line: '1 713738007'

Test #13:

score: 10
Accepted
time: 0ms
memory: 3924kb

input:

47 1
754775836 35
754775836 42
754775836 13
754775836 5
754775836 26
754775836 35
754775836 1
754775836 17
754775836 44
754775836 2
754775836 43
754775836 14
754775836 2
754775836 4
754775836 45
754775836 35
754775836 7
754775836 18
754775836 14
754775836 32
754775836 29
754775836 47
754775836 45
75...

output:

43 32455360948

result:

ok single line: '43 32455360948'

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #14:

score: 20
Accepted
time: 48ms
memory: 3916kb

input:

1919 1
126746165 1373
668827372 1621
842598033 1157
119717982 1647
527842278 1046
492815129 1626
917098873 813
346103003 1197
144760418 1240
339840086 738
518170881 840
527423104 571
783646464 1712
77685618 109
74284316 1850
300769843 524
944005181 736
969138120 917
789000286 1520
358649048 1559
189...

output:

1893 934318516761

result:

ok single line: '1893 934318516761'

Test #15:

score: 20
Accepted
time: 51ms
memory: 3920kb

input:

2000 1
955444834 1441
87345570 1866
807140020 1
452949476 257
818869981 605
161621665 1999
504099265 294
598031629 473
226306660 185
713394097 794
44533525 373
345561041 776
361821668 692
39849424 1340
545901297 794
745021573 1872
939642412 1078
719782870 1693
269723920 839
462215558 627
695935199 1...

output:

1966 990213629004

result:

ok single line: '1966 990213629004'

Test #16:

score: 20
Accepted
time: 43ms
memory: 3844kb

input:

1837 1
404217733 48
760111913 1712
635231398 1010
112054506 1741
297775642 800
988252633 891
547492872 773
447889215 589
184474212 607
98312137 284
514971126 376
705702660 1284
428618641 1138
284561840 221
229651857 551
239129770 892
679610908 491
661999745 1163
564888989 1142
606821489 1504
2943314...

output:

1772 845948441583

result:

ok single line: '1772 845948441583'

Test #17:

score: 20
Accepted
time: 43ms
memory: 3836kb

input:

1814 1
673960138 1285
81028746 1524
421252653 528
23986853 221
239140624 927
891249203 1033
962614277 1620
792355265 793
628225416 1626
970645055 35
385299960 228
737128556 74
351438607 376
255496258 450
185170885 94
93888187 170
198693111 800
844239992 1261
716879039 55
162912511 264
307460806 829
...

output:

1795 883197439380

result:

ok single line: '1795 883197439380'

Test #18:

score: 20
Accepted
time: 51ms
memory: 3832kb

input:

1981 1
655754816 1085
678728908 343
133130441 1927
373977459 1695
938792353 1417
905077842 1207
24418879 1383
525819604 1184
807011577 429
558345553 281
160730060 1935
933294628 445
321504227 13
231009700 1384
362825113 502
450254037 1790
410951067 862
732893408 1254
664094189 1544
36187258 11
72576...

output:

1951 945978796419

result:

ok single line: '1951 945978796419'

Test #19:

score: 20
Accepted
time: 1ms
memory: 3888kb

input:

1811 1
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
9448251...

output:

1 411136

result:

ok single line: '1 411136'

Test #20:

score: 20
Accepted
time: 1ms
memory: 3848kb

input:

1990 1
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670904...

output:

5 6765520

result:

ok single line: '5 6765520'

Test #21:

score: 20
Accepted
time: 1ms
memory: 3912kb

input:

1845 1
439788326 4
290322352 2
986205736 3
710314349 5
685726300 4
853875260 3
971736329 5
438979736 2
886818995 3
172808191 2
420841453 3
510881405 1
431215518 1
199291335 3
467841446 2
683750115 1
257564895 3
202281694 3
826348885 4
385400539 5
217140246 5
456942122 2
41496387 2
829740419 2
751741...

output:

5 6933249

result:

ok single line: '5 6933249'

Test #22:

score: 20
Accepted
time: 2ms
memory: 3776kb

input:

1802 1
332342588 41
970441845 11
719381653 37
922576512 16
177275034 23
488255662 35
253050193 10
620786108 18
709863734 1
807506164 26
624934371 19
657679271 33
968188704 17
636677279 17
733619521 22
326275757 37
349557250 21
712026273 39
248279211 24
165404787 7
373691690 23
404033360 30
769815056...

output:

42 500827803

result:

ok single line: '42 500827803'

Test #23:

score: 20
Accepted
time: 19ms
memory: 3824kb

input:

1873 1
613474075 936
191550631 1
565168039 1
940922606 1
723793989 1
936250872 1
651398486 1
818818788 1
554633771 1
275490534 936
290775497 1
843102091 1
650604084 1
499561988 1
758111235 1
459142648 1
400436681 1
730320150 1
756878960 1
964498323 1
145557078 936
896291394 1
759694823 936
850781148...

output:

923 459262234401

result:

ok single line: '923 459262234401'

Test #24:

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

input:

1 1
22282234 1

output:

1 22282234

result:

ok single line: '1 22282234'

Test #25:

score: 20
Accepted
time: 0ms
memory: 3692kb

input:

2 1
713738007 1
497377109 1

output:

1 497377109

result:

ok single line: '1 497377109'

Test #26:

score: 20
Accepted
time: 0ms
memory: 3584kb

input:

47 1
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
5856...

output:

43 19340489859

result:

ok single line: '43 19340489859'

Subtask #3:

score: 20
Accepted

Test #27:

score: 20
Accepted
time: 104ms
memory: 4100kb

input:

1919 2
126746165 1373
668827372 1621
842598033 1157
119717982 1647
527842278 1046
492815129 1626
917098873 813
346103003 1197
144760418 1240
339840086 738
518170881 840
527423104 571
783646464 1712
77685618 109
74284316 1850
300769843 524
944005181 736
969138120 917
789000286 1520
358649048 1559
189...

output:

1893 934318516761
1893 934319294852

result:

ok 2 lines

Test #28:

score: 20
Accepted
time: 111ms
memory: 3952kb

input:

2000 2
955444834 1441
87345570 1866
807140020 1
452949476 257
818869981 605
161621665 1999
504099265 294
598031629 473
226306660 185
713394097 794
44533525 373
345561041 776
361821668 692
39849424 1340
545901297 794
745021573 1872
939642412 1078
719782870 1693
269723920 839
462215558 627
695935199 1...

output:

1966 990213629004
1966 990214368560

result:

ok 2 lines

Test #29:

score: 20
Accepted
time: 93ms
memory: 4064kb

input:

1837 2
404217733 48
760111913 1712
635231398 1010
112054506 1741
297775642 800
988252633 891
547492872 773
447889215 589
184474212 607
98312137 284
514971126 376
705702660 1284
428618641 1138
284561840 221
229651857 551
239129770 892
679610908 491
661999745 1163
564888989 1142
606821489 1504
2943314...

output:

1772 845948441583
1772 845949272280

result:

ok 2 lines

Test #30:

score: 20
Accepted
time: 94ms
memory: 4076kb

input:

1814 2
673960138 1285
81028746 1524
421252653 528
23986853 221
239140624 927
891249203 1033
962614277 1620
792355265 793
628225416 1626
970645055 35
385299960 228
737128556 74
351438607 376
255496258 450
185170885 94
93888187 170
198693111 800
844239992 1261
716879039 55
162912511 264
307460806 829
...

output:

1795 883197439380
1795 883197614490

result:

ok 2 lines

Test #31:

score: 20
Accepted
time: 112ms
memory: 4088kb

input:

1981 2
655754816 1085
678728908 343
133130441 1927
373977459 1695
938792353 1417
905077842 1207
24418879 1383
525819604 1184
807011577 429
558345553 281
160730060 1935
933294628 445
321504227 13
231009700 1384
362825113 502
450254037 1790
410951067 862
732893408 1254
664094189 1544
36187258 11
72576...

output:

1951 945978796419
1951 945979383131

result:

ok 2 lines

Test #32:

score: 20
Accepted
time: 1ms
memory: 4072kb

input:

1811 2
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
9448251...

output:

1 411136
1 1259454

result:

ok 2 lines

Test #33:

score: 20
Accepted
time: 1ms
memory: 3896kb

input:

1990 2
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670904...

output:

5 6765520
5 7314334

result:

ok 2 lines

Test #34:

score: 20
Accepted
time: 1ms
memory: 4112kb

input:

1845 2
439788326 4
290322352 2
986205736 3
710314349 5
685726300 4
853875260 3
971736329 5
438979736 2
886818995 3
172808191 2
420841453 3
510881405 1
431215518 1
199291335 3
467841446 2
683750115 1
257564895 3
202281694 3
826348885 4
385400539 5
217140246 5
456942122 2
41496387 2
829740419 2
751741...

output:

5 6933249
5 7333923

result:

ok 2 lines

Test #35:

score: 20
Accepted
time: 3ms
memory: 3900kb

input:

1802 2
332342588 41
970441845 11
719381653 37
922576512 16
177275034 23
488255662 35
253050193 10
620786108 18
709863734 1
807506164 26
624934371 19
657679271 33
968188704 17
636677279 17
733619521 22
326275757 37
349557250 21
712026273 39
248279211 24
165404787 7
373691690 23
404033360 30
769815056...

output:

42 500827803
42 500922238

result:

ok 2 lines

Test #36:

score: 20
Accepted
time: 47ms
memory: 4004kb

input:

1873 2
613474075 936
191550631 1
565168039 1
940922606 1
723793989 1
936250872 1
651398486 1
818818788 1
554633771 1
275490534 936
290775497 1
843102091 1
650604084 1
499561988 1
758111235 1
459142648 1
400436681 1
730320150 1
756878960 1
964498323 1
145557078 936
896291394 1
759694823 936
850781148...

output:

923 459262234401
923 459262425406

result:

ok 2 lines

Test #37:

score: 20
Accepted
time: 0ms
memory: 3712kb

input:

1 2
22282234 1

output:

1 22282234
0 0

result:

ok 2 lines

Test #38:

score: 20
Accepted
time: 0ms
memory: 3588kb

input:

2 2
713738007 1
497377109 1

output:

1 497377109
1 713738007

result:

ok 2 lines

Test #39:

score: 20
Accepted
time: 1ms
memory: 3924kb

input:

47 2
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
5856...

output:

43 19340489859
43 19423796403

result:

ok 2 lines

Subtask #4:

score: 0
Wrong Answer

Test #40:

score: 0
Wrong Answer
time: 23ms
memory: 5756kb

input:

19 1910
872059530 14
567896598 17
515371564 12
609933207 17
421749461 11
993851818 17
897732743 9
76274388 12
362276371 13
93554371 8
695969254 9
21709341 6
395396341 17
894018749 2
835539456 19
150700500 6
934168428 8
934249073 10
508532761 16

output:

18 9787132136
18 9846734881
18 9846815526
18 9883251211
18 9886965205
18 9908924424
18 10085014700
18 10171050747
18 10213087356
18 10265612390
18 10272451193
18 10359234493
18 10385587613
18 10418707583
18 10630283454
18 10687429583
18 10704709566
18 10759274613
17 8852883063
17 8852883063
17 88529...

result:

wrong answer 20th lines differ - expected: '17 8852963708', found: '17 8852883063'

Subtask #5:

score: 30
Accepted

Test #53:

score: 30
Accepted
time: 28ms
memory: 4336kb

input:

96 96
390531470 69
349016804 82
612244127 58
41258987 83
470944790 53
681046579 82
109569778 41
700928268 60
224279712 63
681889278 37
173204769 43
701269722 29
624757038 86
271969787 6
444924884 93
500697380 27
509702566 37
262449977 46
669488879 77
170692294 78
362932916 51
118514404 47
724509790 ...

output:

94 42881894279
94 42885031902
94 42886655954
94 42893770642
94 42895394694
94 42898532317
94 42925575942
94 42928026677
94 42934314682
94 42936765417
94 42937452305
94 42939076357
94 42939903040
94 42941527092
94 42942082928
94 42950821668
94 42953959291
94 42955583343
94 42966521813
94 42971243241
...

result:

ok 96 lines

Test #54:

score: 30
Accepted
time: 25ms
memory: 4400kb

input:

100 94
728894101 73
984472362 94
227233955 1
977586505 13
285128553 31
320973763 100
527822662 15
627483044 24
57297596 10
607643414 40
616454087 19
659211250 39
157548605 35
632762003 67
280224048 40
751359820 94
248050921 54
109880759 85
572785958 42
444589230 32
745606493 69
529418708 53
44472160...

output:

93 47229378659
93 47232402986
93 47240022572
93 47243046899
93 47243080404
93 47244995575
93 47248019902
93 47253724317
93 47255639488
93 47258663815
93 47258716409
93 47269360322
93 47274333325
93 47284977238
93 47311778501
93 47314802828
93 47325480246
93 47327395417
93 47330419744
93 47341116251
...

result:

ok 94 lines

Test #55:

score: 30
Accepted
time: 21ms
memory: 4360kb

input:

92 94
833824080 3
502342051 86
575100606 51
294391290 88
857061142 41
584339058 45
874174469 39
88148751 30
393357153 31
883565650 15
913593771 19
553126421 65
436234512 57
237294962 12
29208319 28
801689376 45
265404538 25
463360153 59
72095717 58
953808886 76
540105291 49
859270862 63
753811898 13...

output:

81 39299786951
81 39311847968
81 39312702071
81 39322169910
81 39323024013
81 39329815398
81 39334624591
81 39335085030
81 39335478694
81 39337877883
81 39338731986
81 39339206579
81 39340137340
81 39342946819
81 39347539711
81 39349012273
81 39349528521
81 39350793003
81 39352198357
81 39352592021
...

result:

ok 94 lines

Test #56:

score: 30
Accepted
time: 20ms
memory: 4572kb

input:

90 96
629484261 64
935306493 76
304392773 27
871049171 11
298476078 46
401713369 52
488146744 81
80745508 40
220557674 81
816664936 2
216228749 12
68472304 4
551940937 19
903061070 23
93661821 5
743709824 9
519246013 40
478781953 63
388883752 3
389060106 14
759872727 42
554152379 41
801812652 59
491...

output:

83 39941151331
83 39950335016
83 39953411848
83 39954850187
83 39957150426
83 39960227258
83 39961665597
83 39969410943
83 39970849282
83 39973163230
83 39973926114
83 39976240062
83 39977678401
83 39985423747
83 39986862086
83 39989938918
83 39992239157
83 39993677496
83 39996754328
83 40005938013
...

result:

ok 96 lines

Test #57:

score: 30
Accepted
time: 28ms
memory: 4656kb

input:

99 100
997942797 55
389611075 18
253554815 97
684571690 85
870702547 71
205564015 61
135486527 70
534502368 60
81289102 22
195899258 15
736144729 97
986106280 23
463665422 1
338951827 70
891407683 26
940889978 90
447510152 44
749649611 63
971379429 78
382652692 1
434677763 20
971281184 57
355595918 ...

output:

92 45920709473
92 45922574199
92 45944404733
92 45957903338
92 45958920531
92 45959768064
92 45960785257
92 46000892272
92 46001722203
92 46003586929
92 46005558455
92 46007423181
92 46012687929
92 46014390877
92 46015408070
92 46016255603
92 46017272796
92 46025417463
92 46026186534
92 46027203727
...

result:

ok 100 lines

Test #58:

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

input:

90 91
934941692 1
892631472 1
221963002 1
390559518 1
986350949 1
524427523 1
96444602 1
656854970 1
425992688 1
822387303 1
380252829 1
556647080 1
522523573 1
318687106 1
201564132 1
867885853 1
86695278 1
697351162 1
792894229 1
879902215 1
473852172 1
260425780 1
169983923 1
820738833 1
94482519...

output:

1 1763267
1 2377496
1 6157975
1 15655962
1 24624220
1 26098971
1 69263754
1 86695278
1 96444602
1 97225921
1 100247796
1 119078792
1 127877669
1 154795234
1 169983923
1 177825450
1 190316581
1 201564132
1 202308690
1 214496470
1 219209494
1 219639845
1 221963002
1 260425780
1 272288258
1 278203924
1...

result:

ok 91 lines

Test #59:

score: 30
Accepted
time: 2ms
memory: 3788kb

input:

100 99
356460601 5
224848374 5
881788059 5
68992860 5
44771412 5
397401947 5
115595477 5
638932295 5
106806913 5
568887059 5
653343572 5
449691055 5
569508871 5
360141436 5
518437673 5
668425148 5
886061724 5
470450770 5
810689001 5
790147395 5
418733089 5
556237364 5
257498102 5
621544695 5
1670904...

output:

5 324767380
5 327325796
5 343035094
5 346872135
5 351823658
5 351892640
5 357373441
5 362581433
5 365139849
5 367601938
5 370160354
5 370257120
5 371093583
5 371369997
5 373082739
5 373928413
5 375641155
5 376390502
5 378948918
5 381871303
5 384429719
5 386802881
5 389361297
5 389637711
5 389706693
...

result:

ok 99 lines

Test #60:

score: 30
Accepted
time: 1ms
memory: 3700kb

input:

92 90
973264570 4
852089299 2
193758456 3
368621045 5
795770336 4
322486632 3
453520673 5
541117717 2
457901037 3
669215845 2
681160198 3
705418654 1
561466257 1
278244915 3
445480431 2
435079180 1
1532101 3
716465796 3
99065944 4
471910939 5
761706427 5
839382115 2
563011796 2
735114705 2
747496604...

output:

5 243868061
5 247450067
5 262919655
5 285581097
5 289469511
5 291771729
5 299021523
5 302862167
5 303946339
5 304939099
5 309878292
5 318331755
5 319415927
5 321913761
5 322507891
5 327600541
5 333543795
5 333791173
5 337373179
5 338560573
5 340993197
5 341040967
5 342077369
5 344575203
5 344983910
...

result:

ok 90 lines

Test #61:

score: 30
Accepted
time: 2ms
memory: 3812kb

input:

90 99
611963689 9
627027155 3
280522489 8
41781762 4
194145632 5
479342947 8
401801721 3
202048698 4
509720171 1
673295877 6
268952783 4
231195725 7
905370083 4
162102917 4
908068381 5
575680564 8
775958558 5
107789503 9
474618094 5
785075390 2
588933550 5
672841926 7
536587289 7
402372406 4
7919946...

output:

9 627312446
9 629519191
9 634964641
9 653783136
9 666569284
9 669104270
9 671311015
9 676756465
9 680305569
9 682512314
9 687957764
9 695273397
9 695574960
9 700718847
9 702925592
9 706776259
9 708361108
9 711427019
9 713633764
9 713668575
9 715896048
9 716512151
9 718718896
9 719079214
9 719114025
...

result:

ok 99 lines

Test #62:

score: 30
Accepted
time: 11ms
memory: 4284kb

input:

94 90
993426020 47
340110397 1
42364286 1
694836282 1
46011633 1
685105256 1
182658669 1
495744089 1
300355472 1
56972124 47
433165733 1
41415211 1
723395243 1
182032973 1
257277309 1
853139301 1
190546605 1
174596917 1
137821497 1
148969545 1
75253797 47
378941690 1
682441131 47
520226255 47
934283...

output:

47 18328508147
47 18337846245
47 18338795320
47 18342442667
47 18400357226
47 18407084475
47 18409695324
47 18410644399
47 18413802305
47 18414291746
47 18423908340
47 18425986692
47 18433246438
47 18434195513
47 18434252531
47 18435324790
47 18436273865
47 18437842860
47 18438147877
47 18439921212
...

result:

ok 90 lines

Test #63:

score: 30
Accepted
time: 0ms
memory: 3924kb

input:

1 2
22282234 1

output:

1 22282234
0 0

result:

ok 2 lines

Test #64:

score: 30
Accepted
time: 0ms
memory: 3588kb

input:

2 3
713738007 1
497377109 1

output:

1 497377109
1 713738007
0 0

result:

ok 3 lines

Test #65:

score: 30
Accepted
time: 3ms
memory: 4088kb

input:

47 91
754775836 35
720966791 42
536811951 13
505979127 5
217605295 26
876354039 35
675775060 1
310941447 17
154939582 44
787188025 2
56856271 43
754435010 14
176488825 2
351725042 4
930103697 45
359325051 35
40188748 7
233690931 18
670639934 14
185587886 32
824070707 29
130571086 47
885846939 45
585...

output:

43 19340489859
43 19423796403
43 19575291033
43 19614982748
43 19658597577
43 19682150952
43 19726395713
43 19765457496
43 19786847908
43 19836405037
43 19849783922
43 19919711581
43 19951189059
43 19956643841
43 19961196887
43 20011641254
43 20024576260
43 20034495603
43 20068056806
43 20094947798
...

result:

ok 91 lines

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%