QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#619165#7750. Revenge on My BossshengZzzAC ✓369ms7080kbC++201.5kb2024-10-07 13:22:502024-10-07 13:22:55

Judging History

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

  • [2024-10-07 13:22:55]
  • 评测
  • 测评结果:AC
  • 用时:369ms
  • 内存:7080kb
  • [2024-10-07 13:22:50]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std ;

const int N = 1e5+10;
long long sumb;
int n;

struct Node{
    int a, b, c, id;
    long long minus, con;
}a[N];

bool cmp(Node a, Node b){
    if(a.minus <= 0 && b.minus <= 0)
        return a.con > b.con;
    if(a.minus <= 0 || b.minus <= 0)
        return a.minus < b.minus;
    return a.con + a.minus < b.con + b.minus; 
}

bool judge(long long x){ //O(nlogn)
    for(int i = 1 ; i <= n ; ++i){
        a[i].con = sumb - a[i].a + x / a[i].c;
    }
    
    sort(a + 1, a+n+1, cmp);
    
    long long summi = 0, maxx = 0;
    
    for(int i = 1 ; i <= n ; ++i){
        summi += a[i].minus;
        long long temp = 1LL * a[i].c * (sumb + summi + a[i].b);
        maxx = temp > maxx ? temp : maxx;
    } 
    return maxx <= x;
}

void solve(){ 
    sumb = 0;
    scanf("%d",&n);
    for(int i = 1 ; i <= n ; ++i){
        scanf("%d%d%d",&a[i].a, &a[i].b, &a[i].c);
        a[i].id = i;
        
        sumb += a[i].b ;
        a[i].minus = a[i].a - a[i].b;
    }
    
    
    long long l = 0, r = 1e18;
    while (l + 1 < r) {
        long long mid = l + ((r - l) >> 1 );
        if (judge(mid)) 
            r = mid;
        else
            l = mid;
    }
    judge(r);
    for(int i = 1 ; i <= n ; ++i){
        printf("%d ", a[i].id);
    }
    printf("\n");
}

int main(){
    int T;
    scanf("%d", &T);
    while(T--){
        solve();
    }
    return 0;
} 

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

詳細信息

Test #1:

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

input:

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

output:

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

result:

ok correct

Test #2:

score: 0
Accepted
time: 347ms
memory: 7008kb

input:

1
100000
581297 102863 1
742857 42686 1
676710 233271 1
443055 491162 1
442056 28240 1
769277 331752 1
8608 369730 1
495112 525554 1
787449 938154 1
441186 850694 1
84267 925450 1
740811 32385 1
834021 37680 1
257878 564126 1
90618 914340 1
239641 463103 1
40687 343062 1
587737 458554 1
103684 48666...

output:

70717 6151 48237 28851 35679 19561 94252 73342 13089 34865 69194 82763 50242 22597 3745 24913 97923 53671 77581 47428 82224 93567 61401 50007 4886 54152 28731 91278 99937 6691 26840 6048 46204 66044 60735 44469 20513 45842 18701 46818 27203 9261 50507 8020 72391 54368 86201 18839 64763 61758 40939 3...

result:

ok correct

Test #3:

score: 0
Accepted
time: 335ms
memory: 6936kb

input:

1
99999
30245 831673 1
495617 185056 1
53028 422589 1
503558 778900 1
636981 480008 1
966864 78785 1
644954 303138 1
153080 225499 1
876411 832264 1
758904 549009 1
945000 441995 1
83780 789901 1
883282 832556 1
300776 548075 1
806599 108342 1
354979 831549 1
152110 819163 1
613891 812479 1
856259 6...

output:

42779 26176 16432 93736 36110 21022 69840 33300 88899 48735 24934 97468 58044 16598 54398 41611 25297 90410 54385 14754 38513 7374 40518 45724 3741 95478 36354 5270 92123 87433 5901 57489 42968 40570 60847 61715 65894 68944 27887 3727 38578 14748 15072 79314 41234 42830 79639 35429 60443 63782 12370...

result:

ok correct

Test #4:

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

input:

1
100000
361850 684411 2
188930 167748 2
676274 449963 1
970095 784305 1
412379 854673 1
208323 612179 1
296548 633970 1
560983 633064 2
848966 248363 2
741057 340814 1
393854 435721 2
302707 834494 1
229770 235051 2
875992 747523 2
314215 448795 1
531181 809914 2
786505 95721 1
86557 773136 1
44527...

output:

16321 7131 35939 39108 40409 52183 74664 70501 56736 85313 78033 67062 11374 28893 29910 76382 77675 16590 14329 99654 33902 81051 93812 47118 54934 27805 77685 57504 62353 47016 36321 65709 30222 17782 92966 93722 32969 69339 20699 31143 29231 20833 32593 17020 77014 2193 20753 96742 16406 11108 56...

result:

ok correct

Test #5:

score: 0
Accepted
time: 369ms
memory: 6996kb

input:

1
99999
810798 413222 2
974394 310117 1
987184 606577 2
30598 6635 1
607304 306441 1
438614 583404 1
932894 375890 1
994760 333009 2
937928 950984 2
58774 6426 1
287291 728073 1
421484 592009 1
470520 62631 1
918891 764176 2
997492 642796 1
679223 178361 2
865224 571822 2
112711 192469 1
165146 9387...

output:

38004 71563 34947 26525 22330 44909 47503 52297 78657 28797 29991 22680 7929 68438 15865 70932 27655 90081 30923 61265 20749 31006 35033 64820 20963 86257 21420 27746 3451 43480 36392 44360 16524 76128 8052 60705 72335 52826 82386 88960 8813 60213 12369 84977 96785 82723 23228 1372 34613 67012 54683...

result:

ok correct

Test #6:

score: 0
Accepted
time: 329ms
memory: 6896kb

input:

1
100000
142404 976360 1
924602 517001 3
610429 601247 2
529839 44745 3
606894 456914 2
488586 84093 1
360297 674019 1
435366 740573 3
943187 591275 3
8223 87831 2
703441 689095 1
673115 893499 3
817008 689318 2
237211 187815 1
472404 15953 2
822721 932534 2
275427 591484 3
393890 928933 1
11058 141...

output:

51206 37611 59015 50700 80703 52328 53240 43032 8346 8263 41296 64851 47024 78344 80432 99788 79216 80112 84718 81292 91031 58261 72331 98859 85353 71212 34320 28981 4231 54595 26732 77344 6558 79986 1230 64802 4053 35487 35001 47208 53390 6142 58146 9701 11407 53054 48744 52885 2922 93682 94826 636...

result:

ok correct

Test #7:

score: 0
Accepted
time: 327ms
memory: 7076kb

input:

1
99999
815544 929362 2
644659 659371 3
954043 790565 3
398854 42883 3
577627 875978 2
718877 831126 1
996643 640131 2
869143 249030 3
32149 261192 1
325941 753442 3
372686 238344 2
48789 426822 2
57757 260002 1
280109 237173 3
931489 242658 2
970763 300980 2
578337 100288 1
611532 282858 3
506737 2...

output:

27161 35747 25296 34165 9717 57726 57073 11785 24054 83782 88554 68057 42695 23849 49568 78850 8501 69293 52754 11183 39393 98733 35177 37567 85341 22705 9930 96866 82802 47796 9996 57550 29112 27373 52932 83741 39761 26412 12546 99295 22521 45367 72274 77249 22609 44764 11050 29507 28236 24580 4570...

result:

ok correct

Test #8:

score: 0
Accepted
time: 331ms
memory: 6884kb

input:

1
100000
179854 525204 1
403379 866255 3
544585 817939 4
832686 337889 3
577217 283347 1
960336 331815 3
424045 970964 1
309749 591186 4
37408 677291 2
308093 545247 1
45732 199365 1
267715 728311 2
404245 919393 4
855325 436620 1
406400 774600 3
146965 279345 3
955837 376846 3
860006 276218 2
28724...

output:

24436 23350 14823 6635 16186 28793 85545 28010 65377 49593 9096 36992 62631 55712 98568 36492 47289 43010 3738 84762 70128 48544 57069 75781 59468 17061 39547 97907 7290 48134 29862 84143 19385 42718 49107 41621 94075 30404 65165 61273 78021 98586 89053 17836 39470 53504 98341 37199 90866 20337 9343...

result:

ok correct

Test #9:

score: 0
Accepted
time: 327ms
memory: 6924kb

input:

1
99999
628802 478207 4
156140 784432 3
920902 198745 3
925893 336026 4
772142 702412 2
190627 335745 3
93095 937076 4
710822 356539 2
126370 604104 4
625811 243562 3
714977 524422 2
386493 485827 2
677699 522781 4
898224 453274 1
89677 777113 3
262303 647792 3
291451 852947 2
886160 662847 1
848327...

output:

25476 82833 20708 62196 65199 34417 31863 24519 6410 2660 86721 49138 41559 14233 14538 12861 77995 81983 14766 34516 89431 97096 88505 83091 38565 74389 94338 68659 85344 5885 21302 17145 57922 53773 76261 38160 50466 83035 84330 45236 77809 51690 49927 6715 43442 92483 55111 97458 84347 80388 4440...

result:

ok correct

Test #10:

score: 0
Accepted
time: 333ms
memory: 6988kb

input:

1
100000
993111 41344 2
849452 991316 3
287252 969223 4
392430 565624 3
547540 852885 3
240598 836434 5
520498 11013 2
151428 698695 1
98926 987499 3
607963 259559 2
131127 518148 5
638124 530420 3
991483 116764 5
440736 876913 1
564589 309054 1
438505 593453 5
701654 872609 4
391530 399311 5
628832...

output:

40304 73884 46665 34832 83244 13265 71577 34416 81702 34262 55470 14854 96718 20687 75463 16459 34149 34475 8088 30861 77981 72514 92859 39810 55233 80930 35735 85535 89142 73204 61946 48999 88803 32652 61389 33091 39964 64315 41786 22045 69345 85883 21081 60246 54103 75958 66900 11113 17122 41787 3...

result:

ok correct

Test #11:

score: 0
Accepted
time: 328ms
memory: 6996kb

input:

1
99999
633547 770155 1
634916 133686 5
855058 382733 4
485637 596466 2
742466 271949 3
470889 583467 1
156844 977125 2
585205 464048 5
187887 690121 3
892977 925171 2
57268 34693 4
981093 255232 2
232232 977047 5
516338 893566 4
247866 311567 3
586547 994603 5
4565 348710 5
417684 977428 3
124510 7...

output:

48240 97152 38149 92052 85126 48738 420 86878 1608 77274 25520 16300 85538 61415 87215 9020 23040 6708 82083 15814 66859 99499 16595 23692 38022 28113 27468 68026 15427 8746 33174 14077 72913 80575 26563 66510 41324 17717 35068 39018 73663 45534 19933 82609 30013 16591 13958 58164 4681 66871 61356 1...

result:

ok correct

Test #12:

score: 0
Accepted
time: 366ms
memory: 6884kb

input:

1
100000
997857 590189 5
552421 307866 1
221408 153211 4
952174 826064 4
742055 646614 4
712348 116860 2
808438 307957 5
250004 806205 1
193147 297708 2
875130 941168 5
473418 995714 5
975828 556721 3
578721 379543 1
834658 317206 4
722778 876212 3
730045 972968 6
414768 657972 1
633455 746596 6
970...

output:

58367 96255 27046 51517 62990 14996 43792 8080 70637 88785 56968 29155 30934 51774 59548 29427 90925 70372 58953 41857 33191 96145 17321 23404 87318 1596 46324 13075 9593 11090 26264 56726 77126 83979 64736 94161 65026 25548 5002 62346 36677 33190 44945 17805 87787 14720 15278 41786 55909 91963 1146...

result:

ok correct

Test #13:

score: 0
Accepted
time: 328ms
memory: 7076kb

input:

1
99999
414101 318999 4
305181 450235 4
789213 599425 5
12677 889610 6
936981 98382 2
942639 831190 3
444784 241365 4
683780 538854 3
314812 329 6
192848 447995 3
142664 320771 6
384205 90044 2
595278 174418 6
877557 109667 2
181863 102918 3
910791 341415 2
526191 134073 2
659609 133225 3
690293 561...

output:

35478 18624 78085 84422 64480 8449 51230 4571 89366 63494 34463 41028 36180 21314 30197 81273 40400 69808 42147 3988 98521 2452 13595 43642 69108 39646 93137 95922 39452 1217 10651 80682 35534 34784 49882 14755 73947 23645 38923 95063 30177 52114 49164 98219 208 98408 5373 71603 93716 11385 60484 18...

result:

ok correct

Test #14:

score: 0
Accepted
time: 333ms
memory: 6920kb

input:

1
100000
778411 171737 3
31198 657119 3
155563 369903 1
511917 119207 6
679674 248855 4
992610 588775 5
872187 572198 6
91683 913714 4
254664 416428 3
175000 463992 3
815710 281793 4
603132 358830 2
165958 576913 2
420069 533307 7
656775 410667 2
278481 287076 5
160586 153734 2
164979 126586 2
27930...

output:

10495 78296 86975 66984 43573 26013 68012 28684 21728 84715 73054 55225 80985 71471 19208 75959 3227 49197 78757 51517 90370 45175 30815 33044 22612 38359 10155 50081 38746 20159 29238 80523 64318 24082 8081 80300 49009 47185 51927 50099 81484 31393 93483 48777 27137 18152 11576 10916 63727 96750 55...

result:

ok correct

Test #15:

score: 0
Accepted
time: 325ms
memory: 6992kb

input:

1
99999
451551 900548 5
783958 575297 1
756073 750709 5
605124 150049 5
907304 667919 2
190198 335808 4
508533 538310 7
525460 422171 6
409034 310537 1
268526 129603 1
484955 798337 5
946101 116345 4
215220 404493 1
495671 549960 7
340051 637372 6
169627 688226 2
206600 629835 3
191133 480511 4
3188...

output:

54269 84814 11203 22266 69715 2067 98594 58686 77120 97588 24647 22779 41418 74818 11208 77299 68401 83198 48458 83840 10016 73446 1390 25559 11910 57243 94269 68865 21808 3045 36095 77465 14015 56072 4637 32888 22833 39225 85587 87637 73770 70840 9918 92119 76820 76804 18268 93252 20843 97020 35269...

result:

ok correct

Test #16:

score: 0
Accepted
time: 318ms
memory: 6992kb

input:

1
100000
783156 687878 1
477270 782181 2
122423 521187 1
814765 379647 8
906893 42584 3
464361 836497 8
935935 677655 6
966066 829735 7
348885 726636 6
474870 178304 5
901105 792063 5
940836 193643 7
785900 806988 3
38183 973599 4
814963 945121 3
570021 666591 6
840996 939097 7
406903 216975 2
62090...

output:

72039 60446 79913 606 67084 74974 38540 46212 13925 18473 33329 54770 80078 8805 94531 69295 94929 82414 11017 59740 69274 52094 98394 64031 74594 3026 65376 40859 93220 16215 56539 99398 84080 23209 38748 2719 88190 13990 91697 28371 94299 21350 58000 46528 27 406 68868 13024 13756 32181 12213 6526...

result:

ok correct

Test #17:

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

input:

1
99999
45362 965532 6
708808 306508 2
624384 151389 1
467716 670928 1
39438 96594 5
942210 88149 7
892926 875304 8
241522 637190 1
564772 772170 8
835563 334036 7
104129 627390 5
911109 785971 7
389695 864643 9
475004 239058 3
432237 738985 3
818115 349146 8
665532 910961 8
964582 950889 9
682361 7...

output:

17464 54738 19792 69939 35189 77452 89261 55631 50252 91841 70330 4005 64528 98810 51735 25631 44169 2070 89979 41652 86742 62362 45691 29466 82233 78136 91194 51184 6693 82962 21064 93923 22440 83984 47051 39021 91148 97090 43528 17339 33500 58672 69501 561 7869 9766 74630 46576 40530 51413 7570 62...

result:

ok correct

Test #18:

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

input:

1
100000
545343 214678 2
896330 34297 10
225650 145117 5
3539 141992 10
866014 337066 4
787360 33077 10
990193 565400 7
746446 687990 6
657093 370479 9
221001 777823 3
818490 795673 2
891597 771810 3
322069 291555 3
680477 429062 4
131032 471991 3
498884 709254 9
4962 615960 7
537100 173421 1
166345...

output:

47267 41095 99945 82746 72235 4514 7505 33683 57213 5896 21646 65793 2233 37477 35903 26024 55083 75580 81907 2157 93532 35053 37297 29849 58079 67046 3739 68803 90621 34886 53352 54246 56947 73238 88362 25725 54684 92792 65858 7259 30656 70002 31250 66964 37747 13385 86380 82236 46760 47662 82866 1...

result:

ok correct

Test #19:

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

input:

1
99999
336110 764075 4
762927 765956 4
275286 70789 5
459972 469529 7
870966 316414 7
498229 41636 11
830500 307315 6
854475 488251 5
759873 905341 5
993842 970385 9
217019 809676 12
207189 933113 4
625602 520131 7
736635 340574 11
921162 795091 6
552353 769663 10
406594 84507 8
465432 768495 3
892...

output:

39708 59543 43462 38768 62809 86685 85130 49266 10175 30405 5060 45395 16901 19161 77253 78326 74569 15283 81622 25091 32911 13276 24367 31315 53191 86779 19835 56034 94131 84931 2385 7006 43089 26503 35302 20787 17665 96835 31205 81685 18723 58976 78156 39068 12414 83152 77700 16443 27841 74989 144...

result:

ok correct

Test #20:

score: 0
Accepted
time: 339ms
memory: 6884kb

input:

1
100000
108561 606864 17
350323 824178 19
354491 276661 2
386504 972995 8
126712 330871 13
27512 558033 16
821693 489290 10
531173 946706 11
851074 696984 13
215023 489278 3
550601 849390 9
18144 714207 18
493423 166694 1
682070 122973 15
480819 38485 4
803701 169413 20
175493 785397 12
948045 5586...

output:

75830 42942 27955 67628 18688 75983 38085 55857 99543 58665 84286 98998 62210 79210 59646 20199 18423 96728 65122 77421 90405 52319 32112 50628 76760 47925 52882 92378 23843 58452 908 20803 85457 44246 89707 12492 61643 74369 62071 90435 5029 72372 58509 36921 3618 49681 66178 35530 49608 3543 52130...

result:

ok correct

Test #21:

score: 0
Accepted
time: 329ms
memory: 6916kb

input:

1
99999
270178 61120 9
118244 697562 5
796784 638127 10
716782 572441 25
868171 877138 2
451141 273737 29
917860 184163 26
669039 916520 30
900920 422991 7
772136 494308 18
675065 814143 30
968370 228164 17
447803 120035 26
195744 975315 19
310881 998911 19
512798 212819 4
789254 622264 22
984709 59...

output:

40137 5954 84879 13698 97786 83795 24220 24459 79395 99256 72457 96580 64413 25163 69801 34854 83596 7423 90706 88839 38803 16892 91637 19046 79416 30020 78757 9334 4192 86062 72933 27990 51333 17602 33609 75946 32500 4186 51747 2025 96710 94070 92015 66672 69739 24229 51979 45692 29176 34656 33789 ...

result:

ok correct

Test #22:

score: 0
Accepted
time: 321ms
memory: 6924kb

input:

1
100000
87815 816125 15
712301 586652 26
997911 895483 38
726884 50324 43
427717 312286 28
196351 258982 19
474976 452448 13
371565 914341 28
848695 643798 25
229795 39321 27
129910 753647 6
206296 219095 38
680062 142384 26
752256 980514 31
628293 803374 32
592071 806785 7
70061 583309 35
732498 3...

output:

91856 68167 54045 70962 56607 12074 19415 40950 56580 27223 78432 86849 52217 24146 93734 46920 62508 941 99732 23778 20805 44874 15261 84221 86023 27614 78728 28278 34192 54860 54949 76596 80771 70120 85957 75815 52991 22237 20514 80807 57607 81299 31493 61250 55697 68579 46442 13520 88697 44615 28...

result:

ok correct

Test #23:

score: 0
Accepted
time: 328ms
memory: 7004kb

input:

1
99999
969047 371 41
853468 252554 79
784554 756858 19
945912 189669 56
28679 367615 21
745635 438170 93
394681 487499 76
986024 222074 12
796761 902579 3
934082 772826 5
848868 475664 57
928859 487080 17
447261 415165 48
324804 77833 94
513254 520849 43
811124 531448 22
414298 235550 92
662853 204...

output:

41617 69476 22349 42877 49036 44100 55797 47684 17642 61367 21015 5928 60421 94902 63629 51537 41225 92090 1341 55407 50764 79386 92827 39635 76780 44973 55189 84540 3426 94028 19108 64882 30657 14953 75080 41940 44855 39038 39158 30651 22540 80746 57236 52623 38781 39532 83418 57354 45600 31028 303...

result:

ok correct

Test #24:

score: 0
Accepted
time: 333ms
memory: 6888kb

input:

1
100000
14578 331976 83
739173 945866 58
769064 123208 197
657914 688910 162
63712 334500 95
112850 488141 182
673605 139094 109
8038 662680 177
139883 875134 102
240255 754978 10
139120 891814 83
967220 706007 107
811284 728949 43
749285 653050 130
42454 995761 196
897079 899138 87
585743 869946 6...

output:

90508 94750 27222 98260 80046 51121 56997 85539 55322 91100 17379 96156 22969 13531 10457 30621 86229 18277 36510 92827 55960 30867 58396 33774 91809 70195 11030 79401 31090 94637 24041 81483 46426 40803 23017 89624 18025 61078 92413 91500 55935 81594 3394 31037 49079 38664 15546 25652 88003 60915 2...

result:

ok correct

Test #25:

score: 0
Accepted
time: 331ms
memory: 7004kb

input:

1
99999
776558 379481 222
389786 326445 297
33988 301992 167
922081 171748 27
44539 631883 366
435819 942194 271
728896 223581 455
306860 878391 458
944588 214055 460
459371 939603 266
655301 555228 355
491970 417096 153
318104 764115 348
829143 260691 86
14484 737924 368
508188 763016 368
738889 88...

output:

51087 24925 9188 80737 75625 49059 13150 17689 4942 14937 41090 15393 54230 7347 65007 36235 81067 31749 80027 45190 50983 32941 45815 3118 77029 47944 18060 87580 39178 10109 71391 12284 54426 78322 56688 36466 29023 50964 8976 4073 50273 63636 83987 96474 46305 27725 98185 36169 13266 69800 99536 ...

result:

ok correct

Test #26:

score: 0
Accepted
time: 333ms
memory: 7072kb

input:

1
100000
953776 515469 53
574495 620563 408
331343 705288 552
307179 689650 745
108389 820839 791
831194 34474 881
928795 832739 27
162288 848143 103
438197 683261 522
872355 234923 123
275412 349154 731
403641 327600 231
642668 821247 651
639908 457535 877
184578 621090 792
483486 866841 827
382761...

output:

4481 77517 55861 82021 91171 10278 91599 22352 62997 88175 21543 95213 3653 42138 64829 7098 69951 46439 75512 4374 40173 11528 80373 6310 21548 60450 68611 88084 12345 94012 90077 19911 83423 13985 384 69712 88308 69715 52689 60124 14250 17160 25248 66750 17052 98894 79338 69625 79851 25187 18434 6...

result:

ok correct

Test #27:

score: 0
Accepted
time: 325ms
memory: 6996kb

input:

1
99999
128495 399445 763
873699 750462 2051
771645 791001 3841
668391 425718 3815
274257 54791 3769
572299 402750 3749
622972 357997 1273
354814 50592 1657
409819 763434 3342
941450 774102 2301
705607 604543 3333
441889 400571 2267
563457 738075 3090
751849 8690 1656
524888 757409 1699
294794 33160...

output:

59747 83810 55200 87084 45820 27249 44444 80277 96910 44267 49337 46391 99077 43308 29471 90913 8622 86230 91783 97679 64912 29568 86567 17657 78874 60441 82493 24132 64950 69905 46445 71561 84500 76107 90240 62907 12272 3753 71573 31014 33888 16842 93642 26316 90084 8250 68748 61042 85844 99123 620...

result:

ok correct

Test #28:

score: 0
Accepted
time: 331ms
memory: 6996kb

input:

1
100000
722958 355226 2094
266625 467230 8712
979360 944520 2487
295170 735423 2727
722419 313725 3199
789942 961946 9194
700692 559861 7780
649116 795879 2218
690710 741191 3253
493019 510759 8703
230105 693648 3581
776356 568494 6123
384478 553056 8000
262437 617457 2646
944585 4132 9669
239024 3...

output:

84561 1956 1921 79444 50520 20450 55307 96079 67301 91853 61420 42651 21163 9444 12373 97592 96096 9322 30475 72842 19132 28577 77890 87950 81719 17283 87180 80783 12157 69705 36917 92110 732 31518 1661 23690 41130 51353 23548 12879 43835 82974 26007 73034 12545 28964 2061 39954 9803 17593 70166 771...

result:

ok correct

Test #29:

score: 0
Accepted
time: 329ms
memory: 7008kb

input:

1
99999
846662 746684 27049
416087 114018 39556
827768 480922 19619
538880 640896 35309
974134 999365 37801
462745 682933 806
606482 571441 8720
401083 408557 32312
797890 970757 39099
378069 473292 33198
452952 185965 42390
524236 671077 29109
746622 849987 48916
692368 638905 26915
476085 504542 1...

output:

70482 21335 15461 85424 95385 20665 79381 30388 13895 84891 10841 46253 66878 65901 4704 84176 95878 60820 19212 9508 47085 49421 65239 42175 77219 59780 34249 44035 30352 69531 39889 74948 23900 72251 28815 16749 47511 75309 90877 43450 1233 65449 3744 80227 13231 82141 27093 80311 14857 18607 2357...

result:

ok correct

Test #30:

score: 0
Accepted
time: 327ms
memory: 6920kb

input:

1
100000
971466 923902 13036
178471 298728 9482
405999 2470 22915
603996 25994 53211
456448 30511 11349
18316 78308 17277
863127 738636 42069
857249 263985 26256
617839 464366 58305
395945 918980 28518
969530 806076 36316
806039 806940 96509
282118 141847 56048
595896 449670 41054
190736 674636 4589...

output:

52506 79478 72234 34784 78527 65246 66044 77266 36995 15855 54295 24323 33391 4024 18544 5012 31294 72670 71248 82034 2670 59414 49034 62029 39641 35240 32621 82721 49330 90317 80489 82149 8302 36103 64680 31501 65040 27993 32181 22362 15627 16900 59686 76249 27378 54603 14251 49191 83851 46411 3544...

result:

ok correct

Test #31:

score: 0
Accepted
time: 326ms
memory: 6920kb

input:

1
99999
932826 868158 836741
757509 147472 90812
420972 457136 757627
569138 433050 395584
828836 391573 506718
940415 3167 875552
397212 243182 713853
389349 453435 165834
612841 415193 497972
43233 799293 174303
652096 485581 690886
929649 7236 344171
963593 933013 38136
677458 266199 985380
12930...

output:

29923 69067 45530 56085 46407 77118 597 22067 59156 31824 27915 47967 86140 85811 92426 58101 52397 22833 31888 69838 2615 80882 52064 54673 61865 35466 30058 74909 22248 34503 86002 76331 56364 63474 58775 58189 51899 12053 29273 63262 42405 61959 10658 1623 38992 93935 35496 61801 50078 76216 3979...

result:

ok correct

Test #32:

score: 0
Accepted
time: 288ms
memory: 6928kb

input:

1
100000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
1000000 1000000 1000000
100...

output:

66616 66615 66590 66613 66589 66611 66588 66609 66587 66607 66586 66605 66617 66603 66639 66627 66637 66625 66635 66623 66633 66621 66631 66619 66629 66585 66651 66737 66649 66736 66647 66735 66645 66734 66643 66733 66641 66591 66614 66584 66612 66583 66610 66582 66608 66581 66606 66580 66604 66543 ...

result:

ok correct

Test #33:

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

input:

1
10
2 10 1
8 10 6
4 4 9
6 7 5
5 6 4
7 10 9
7 7 7
4 9 6
4 5 7
1 1 7

output:

1 5 4 8 2 10 9 7 3 6 

result:

ok correct

Test #34:

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

input:

1
10
485566 661308 221125
602000 2 6
714165 6 3
7 596643 587186
7 985484 2
197190 2 2
7027 8 5
10 5 8
621058 1 688117
10 633379 164945

output:

5 10 1 4 9 8 2 7 3 6 

result:

ok correct

Test #35:

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

input:

1
500
229 232 88
36 27 60
158 1 343
356 247 333
440 3 271
420 78 50
181 212 302
384 444 209
284 184 393
416 482 51
242 373 331
355 470 251
382 151 262
206 32 237
483 310 124
275 93 258
212 154 247
379 62 28
456 185 159
454 82 476
168 46 144
17 312 499
10 77 276
339 173 69
330 373 17
256 448 498
223 ...

output:

31 230 131 33 326 378 185 461 86 25 27 69 166 436 275 202 355 445 191 119 103 244 39 37 468 313 170 344 41 10 499 227 489 307 29 151 208 333 405 129 469 141 430 480 89 187 234 441 353 61 1 146 303 374 472 490 54 390 335 368 94 411 373 53 198 159 348 241 487 97 150 109 140 433 62 105 494 210 178 497 ...

result:

ok correct

Test #36:

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

input:

1
500
20004 38 372
100 16 181
149374 35468 294245
126267 486 452
286 412 200
747456 213887 767656
117 847144 226
308111 342 520765
304 80 110121
49258 561097 546419
63074 509481 733960
126 775895 373701
339 365928 385
30 199 318
134197 411 103412
5333 220 336
87 489 25508
166200 987909 511327
476 35...

output:

238 227 198 209 353 440 429 299 340 464 237 326 412 182 499 491 207 496 428 93 320 329 277 111 301 63 53 336 375 281 432 26 335 376 163 403 144 406 32 389 226 303 318 51 473 33 214 70 188 399 5 358 7 77 356 122 407 383 91 72 99 465 365 487 309 341 445 282 181 421 151 219 478 316 180 241 236 97 128 2...

result:

ok correct

Test #37:

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

input:

1
1
1 1 1

output:

1 

result:

ok correct

Test #38:

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

input:

1
1
796328 1 719733

output:

1 

result:

ok correct

Test #39:

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

input:

1
100000
61850 84411 46680
88930 67748 47416
76274 49963 99253
70095 84305 34027
12379 54673 14197
8323 12179 31657
96548 33970 69265
60983 33064 76580
48966 48363 63608
41057 40814 26167
93854 35721 27144
2707 34494 18821
29770 35051 54832
75992 47523 9044
14215 48795 25989
31181 9914 69544
86505 9...

output:

7549 33053 37908 46813 18895 44641 81944 92325 55087 98532 20790 39937 1297 10405 51616 98196 51933 29106 29738 51039 33985 81967 92294 96105 95768 43823 52075 34846 48772 52010 48619 85978 39958 38637 50896 47989 30137 45221 4141 88670 3902 85122 22345 22848 87671 50166 24834 75266 40592 76101 4975...

result:

ok correct

Test #40:

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

input:

1
100000
924602 76894 76360
529839 605505 1247
488586 3766 456914
435366 724358 674019
8223 142516 591275
673115 962254 689095
237211 66450 89318
22721 63332 15953
393890 854351 591484
17037 15993 141132
11900 8268 23752
2906 528321 54437
93877 9808 79501
959623 40054 54992
86687 65830 886221
160821...

output:

12335 92245 60547 4405 30790 34394 39818 73444 89849 8833 5549 21464 70585 39531 63678 23364 2948 76571 58867 27058 95278 30507 87024 80202 13539 88143 32610 3012 23044 79798 56251 25952 4415 3906 40905 27544 48810 93292 18654 23995 49808 17603 42485 54252 18602 80995 8233 69325 72871 88714 35977 51...

result:

ok correct

Test #41:

score: 0
Accepted
time: 283ms
memory: 5940kb

input:

2
69821
88401 742421 1
794466 913634 1
103831 780090 1
194366 83442 1
891069 901851 1
14782 827286 1
629158 268122 1
511572 261569 1
64650 726005 1
435161 580063 1
108579 365076 1
257108 490883 1
723162 813583 1
816841 933459 1
333041 428483 1
211846 962418 1
723314 157335 1
837290 54766 1
138584 58...

output:

39242 24912 37635 12878 58141 37503 57255 52102 26851 42115 13266 26543 48086 7772 68038 16815 50533 10858 53523 21194 42401 35354 23612 51845 27618 26397 34164 4171 58980 58034 68116 26091 55364 15974 33614 67378 34316 7021 45547 6835 34366 28136 44038 55376 14109 65357 34978 26523 69443 53668 2335...

result:

ok correct

Test #42:

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

input:

300
253
830133 947891 1
363214 158400 1
678623 525243 1
557424 435477 1
140409 99787 1
957753 183966 1
626409 249098 1
710920 607523 1
15679 17828 1
876419 80539 1
167749 400048 1
269258 222458 1
150536 140001 1
666204 606142 1
46951 206706 1
655815 806710 1
258588 306955 1
735893 932947 1
841224 14...

output:

180 9 159 174 58 135 68 67 164 240 111 225 15 179 32 224 153 23 194 186 108 119 70 199 253 243 242 223 109 237 53 244 38 72 104 140 247 234 229 11 125 115 35 129 122 86 69 137 178 219 142 65 249 50 207 105 128 60 17 27 56 75 91 200 37 235 107 166 28 124 29 59 123 103 126 221 98 155 156 136 187 154 1...

result:

ok correct

Test #43:

score: 0
Accepted
time: 86ms
memory: 3900kb

input:

10000
1
425023 723812 1
13
836095 863384 1
233225 596397 1
566137 236643 1
268085 280508 1
223291 393445 1
809612 382630 1
151088 862073 1
173393 927632 1
17049 195961 1
677649 745628 1
36991 667660 1
298669 836826 1
362975 372403 1
1
963621 249133 1
6
3536 279568 1
587752 487419 1
83384 748663 1
58...

output:

1 
9 11 7 8 5 2 4 12 13 10 1 6 3 
1 
1 3 4 6 2 5 
7 4 1 2 6 5 8 3 9 
1 
1 2 3 4 6 5 
7 6 1 5 3 2 4 
12 19 8 18 16 14 11 5 1 15 20 2 9 23 6 17 10 13 7 4 3 24 21 22 
8 5 11 4 6 9 7 2 12 3 10 1 
8 25 16 9 15 17 18 10 21 6 7 4 11 14 12 13 2 3 23 1 5 24 19 22 20 
8 7 2 11 3 13 10 9 6 5 4 1 12 
9 7 4 1 8 ...

result:

ok correct

Test #44:

score: 0
Accepted
time: 129ms
memory: 5916kb

input:

2
4037
464131 318220 1
90991 541050 2
766311 591558 1
742307 17787 1
781261 488145 1
357957 347184 1
633182 301261 1
94682 843291 1
631637 529027 2
82521 704473 1
437456 276755 2
778263 51432 1
786584 977440 1
833333 648570 1
552303 601466 2
938184 44857 1
794073 277387 1
994953 290395 1
935853 1864...

output:

1837 2352 3405 1674 1491 2947 3658 3510 970 613 1675 2265 3123 3559 1733 1895 1260 403 2051 3019 2949 3286 3872 3197 2882 902 2199 2556 1205 2038 3507 1507 2924 3147 3226 2300 2133 3525 81 2614 1488 3984 1662 2460 2448 3737 2027 2826 251 1556 846 456 836 1376 3424 2754 3858 1174 212 683 2993 2541 25...

result:

ok correct

Test #45:

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

input:

300
134
36059 286818 2
455971 795720 2
74275 63495 1
75077 509010 2
503679 169175 2
11185 421244 1
437281 322883 2
869878 384461 1
191807 672570 1
288040 312855 1
660008 723414 2
221648 416391 2
624391 145096 1
411858 695660 1
578102 665090 2
890142 668549 1
608518 448483 2
113307 706064 1
283662 63...

output:

36 6 29 79 84 133 127 98 112 97 18 92 9 67 91 24 104 109 28 87 43 25 19 10 89 62 90 23 71 32 14 123 50 110 117 99 40 113 77 45 64 1 63 80 4 22 41 132 122 12 54 129 68 108 78 102 61 72 33 128 55 2 70 15 107 101 11 52 31 38 37 88 51 103 131 121 130 17 76 111 56 39 60 114 134 7 94 57 48 65 46 105 5 74 ...

result:

ok correct

Test #46:

score: 0
Accepted
time: 91ms
memory: 3872kb

input:

10000
2
525139 532331 2
923628 228718 1
6
234983 515915 1
705263 115904 2
902643 575572 1
90796 310572 1
191007 876742 1
926631 224132 2
1
363621 733700 1
16
617390 281024 2
354701 28586 2
902129 562488 1
711461 107434 1
714910 223331 2
835971 497838 1
118657 220815 2
375999 800233 1
180250 455648 2...

output:

1 2 
4 5 1 6 2 3 
1 
8 7 9 10 12 16 15 1 5 11 2 14 3 6 13 4 
5 4 2 1 3 
1 
1 5 4 3 2 
8 5 6 3 7 1 4 9 2 
1 
1 2 
14 12 3 11 6 15 13 10 5 1 4 7 9 8 2 
2 1 
5 27 20 25 4 8 22 6 1 17 12 19 14 13 2 23 7 21 18 10 16 26 9 11 24 3 15 
12 1 4 9 11 3 5 7 10 6 2 8 13 
2 1 
27 11 23 26 13 10 12 17 6 2 15 28 3 ...

result:

ok correct

Test #47:

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

input:

2
1389
643295 305353 1
17366 456325 2
596129 942726 1
830936 621567 2
604681 76325 1
774761 275083 3
176002 127294 2
580914 456741 3
634013 437706 1
24737 134880 1
556648 720413 2
801133 640387 2
9231 991784 3
966796 684261 1
847283 768303 2
804657 879431 2
288649 139591 3
511819 701938 1
27061 5639...

output:

941 848 327 992 790 74 831 476 10 986 833 393 79 350 329 57 702 517 1158 1031 507 415 565 388 1037 829 1367 1081 1334 908 580 201 976 610 1001 1010 267 581 261 377 748 396 1149 532 974 167 1200 792 1094 1084 331 504 743 1109 1114 1199 575 1363 45 843 1101 191 1314 1184 818 1299 1389 284 1110 1384 10...

result:

ok correct

Test #48:

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

input:

300
251
789119 100187 2
697580 571877 2
686584 10582 2
418190 372990 2
788026 231797 3
985515 398910 3
237323 766683 2
364345 244638 2
629965 746778 3
442153 340088 3
998666 429796 1
755218 985359 3
840002 539125 1
373406 54563 3
638707 859838 2
656500 817395 3
899880 742356 1
90021 71315 1
883077 9...

output:

37 72 56 88 228 174 153 157 182 152 84 248 124 90 138 169 205 194 125 188 67 139 166 158 40 232 61 47 227 28 207 131 164 192 167 224 57 163 210 70 136 183 225 206 104 202 200 178 244 51 215 196 114 180 82 243 62 191 7 193 208 234 217 23 121 24 133 60 148 122 218 25 102 115 176 238 111 63 15 26 128 8...

result:

ok correct

Test #49:

score: 0
Accepted
time: 86ms
memory: 3880kb

input:

10000
9
340849 332736 2
337156 473580 3
725034 883073 1
219356 12503 2
936044 549719 3
227698 971858 2
370855 568407 1
618895 291761 2
507065 78488 2
8
333383 660664 1
344247 932637 3
200420 429670 2
536827 573382 1
106963 127237 2
713838 866936 2
162062 279088 1
145752 929994 1
4
905737 522662 1
53...

output:

7 3 6 2 5 1 8 9 4 
8 7 1 4 5 3 6 2 
4 3 2 1 
1 3 5 4 6 2 7 
5 10 13 1 6 3 4 16 2 9 15 7 11 8 12 14 
1 2 3 
1 
2 1 
1 3 2 
1 3 4 2 5 
3 2 10 5 1 8 13 4 12 7 6 14 11 15 9 
3 2 1 4 
2 1 
27 28 14 19 13 2 25 23 16 5 15 4 29 24 21 8 10 7 31 30 1 17 20 32 26 11 9 18 12 22 6 3 
1 7 2 6 8 10 14 12 3 11 5 13...

result:

ok correct

Test #50:

score: 0
Accepted
time: 177ms
memory: 5492kb

input:

2
2795
297292 539767 8
734875 511215 9
667232 536489 8
634005 856493 3
580380 622144 4
581010 98539 9
919508 825607 6
524199 860110 5
802059 591467 8
885913 685100 5
565378 910253 9
490311 943067 1
567041 155343 7
328533 943487 1
154277 487096 1
812892 214739 10
113962 103658 5
687184 187384 6
83481...

output:

2341 233 2265 2025 827 1528 2231 1479 1452 1150 1551 1297 1834 2154 464 1913 1665 1794 628 552 1357 819 940 2021 1304 1682 927 2637 2277 1346 2180 807 560 1608 2148 1589 53 1456 469 2788 426 387 1969 15 2634 2215 1985 51 596 2632 1650 680 1954 930 1200 2123 803 1050 2502 711 2471 355 1374 2410 1473 ...

result:

ok correct

Test #51:

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

input:

300
313
181024 742572 1
847307 106677 9
375980 457310 10
944809 442603 4
570686 894299 8
124371 282741 6
44756 196447 1
312495 303886 8
855637 365548 2
972108 981965 9
657516 19589 9
184806 920191 8
29602 361256 6
752410 616901 2
758651 50575 9
571691 387695 5
601171 137962 8
707125 753434 5
644216 ...

output:

72 7 57 303 29 126 189 230 75 1 89 70 231 255 257 107 109 247 171 311 203 227 282 280 232 62 179 24 211 252 295 173 144 243 234 122 276 146 129 291 313 195 74 130 221 120 167 265 65 26 244 250 259 88 68 206 116 103 228 289 21 51 49 172 220 43 263 156 269 308 90 48 182 164 246 213 236 18 28 135 169 1...

result:

ok correct

Test #52:

score: 0
Accepted
time: 87ms
memory: 3808kb

input:

10000
17
780658 578371 3
47635 686616 8
318753 263312 2
655616 417338 1
224671 828602 9
230974 643576 4
874831 202616 2
177657 47352 1
619169 180834 6
337414 98608 8
14938 561758 2
190162 790130 8
422120 130445 3
907851 740409 5
310886 389878 7
659021 276403 7
973677 834994 7
11
229775 712783 3
6087...

output:

11 6 15 2 12 5 10 17 16 9 14 1 13 3 7 4 8 
1 3 10 4 5 8 11 6 7 2 9 
4 5 3 7 1 2 6 
7 9 5 18 22 4 15 24 1 13 17 23 19 6 14 12 21 20 3 8 10 11 16 2 
8 4 1 7 3 2 9 5 6 
1 
4 2 1 5 6 7 3 
14 31 11 25 13 4 29 10 15 12 7 23 24 20 28 17 32 33 3 16 6 18 1 9 21 26 8 19 30 27 2 5 22 
1 
1 2 7 4 3 6 5 
12 11 1...

result:

ok correct

Test #53:

score: 0
Accepted
time: 261ms
memory: 6552kb

input:

2
48688
685632 618517 40
946415 334447 43
752761 979212 40
433885 69891 33
569670 946047 93
555989 124478 93
274327 869785 90
485360 45389 42
23642 844669 87
140871 587747 87
869963 693679 53
676186 65537 42
881980 192065 40
873410 311493 61
534245 627841 18
244185 178870 82
499887 451233 95
57767 1...

output:

31633 9794 9666 19262 5405 45574 44251 36147 36349 48212 614 43692 37270 36427 36099 19432 11560 29581 32990 45754 4789 13063 29531 5313 45986 4942 46946 15962 4094 26533 45672 27647 32768 42749 40684 45766 11054 42215 212 585 35425 27427 5087 37938 15881 31127 40108 31340 24514 24472 44355 1752 354...

result:

ok correct

Test #54:

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

input:

300
420
669837 320560 61
258799 886730 73
164105 746610 57
84838 703770 100
636583 273782 59
825002 115141 78
369165 503638 51
53323 943414 79
179758 717391 39
255236 708325 60
241304 628458 67
884196 464104 76
930360 853422 67
337726 677439 64
580974 613764 10
122706 882972 69
57560 259562 36
45657...

output:

275 345 406 154 146 297 153 94 389 326 256 364 377 280 387 104 124 45 15 75 98 269 353 225 315 46 166 133 370 358 246 230 156 249 196 311 79 193 398 298 369 279 132 260 259 258 399 407 197 290 203 93 251 346 142 309 58 107 276 215 378 413 228 410 110 17 372 227 123 404 9 184 363 74 412 127 334 284 1...

result:

ok correct

Test #55:

score: 0
Accepted
time: 83ms
memory: 3888kb

input:

10000
23
973684 7831 94
537048 731681 14
882601 751411 72
431976 93550 32
816227 731555 4
7075 314732 17
268202 295472 66
798245 717683 68
660640 145985 83
243308 363161 59
498791 751204 31
621033 843418 6
970638 854301 50
968200 810305 100
401858 497645 91
320766 661915 35
832051 354020 26
871379 8...

output:

12 2 6 20 11 16 23 19 10 7 15 22 14 1 9 3 8 13 4 17 18 21 5 
14 1 8 19 6 10 3 16 11 5 17 2 9 12 4 18 13 7 15 
1 
1 
6 12 13 7 1 9 5 16 11 14 3 8 4 10 2 15 17 
7 5 1 2 3 4 6 
2 3 1 5 6 4 7 
2 5 3 8 4 6 1 7 
23 15 1 9 16 14 4 21 11 17 5 2 12 8 7 6 19 22 10 18 3 13 20 
13 7 21 8 5 12 22 9 17 19 24 11 6...

result:

ok correct

Test #56:

score: 0
Accepted
time: 67ms
memory: 3760kb

input:

20000
5
564336 480387 1
430553 699081 1
278563 238435 1
419891 873247 1
776080 588695 1
5
970707 986491 1
988325 837799 1
616860 966847 1
927749 400769 1
793152 488151 1
5
217283 631630 1
967252 903221 1
354591 389526 1
62194 938123 1
835140 509270 1
5
510932 530250 1
959618 144352 1
770415 705305 1...

output:

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

result:

ok correct

Test #57:

score: 0
Accepted
time: 69ms
memory: 3808kb

input:

10000
10
246428 90732 1
303821 684428 1
301599 422756 1
515216 177567 1
321822 555733 1
994857 742288 1
371128 250193 1
31645 742720 1
783257 82443 1
830750 747553 1
10
461123 817287 1
199478 259329 1
726303 791746 1
27694 235096 1
859908 373085 1
644286 804111 1
225287 406992 1
847610 747793 1
9096...

output:

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

result:

ok correct

Test #58:

score: 0
Accepted
time: 91ms
memory: 3956kb

input:

5000
20
875906 903989 1
75804 163205 1
605781 389616 1
315307 704607 1
769739 526056 1
425579 22550 1
294714 313941 1
345502 617103 1
208118 176664 1
349977 14719 1
437260 126874 1
66912 821226 1
259518 411687 1
969283 629018 1
677888 307082 1
334904 95651 1
668531 120105 1
807802 22421 1
989024 435...

output:

12 2 13 7 4 8 1 20 14 5 3 15 9 11 17 16 19 6 18 10 
15 13 2 5 14 6 20 18 19 10 12 16 17 11 9 7 1 8 4 3 
7 9 16 19 6 18 17 1 11 15 14 4 5 8 12 2 10 13 20 3 
1 12 4 9 7 8 15 20 19 11 5 3 17 14 6 10 16 13 18 2 
13 9 1 12 16 14 8 4 17 7 3 18 6 5 11 10 15 19 2 20 
7 13 1 20 18 8 17 19 2 11 6 15 16 14 3 9...

result:

ok correct

Test #59:

score: 0
Accepted
time: 122ms
memory: 3872kb

input:

2000
50
988531 726738 1
872842 823728 1
518328 224786 1
715577 126942 1
146194 885409 1
652337 989417 1
546559 762083 1
352481 431741 1
706893 426624 1
99143 881626 1
300261 929556 1
827997 156642 1
340250 173400 1
532034 226466 1
361138 590160 1
149862 2975 1
549878 67959 1
562298 327394 1
128887 2...

output:

29 10 5 37 46 11 22 8 15 48 25 27 30 7 6 32 28 21 42 44 31 2 1 20 49 40 23 47 34 36 38 9 18 24 14 3 26 13 12 50 39 4 41 17 45 43 35 16 19 33 
50 15 23 39 43 19 35 40 18 11 37 32 25 47 21 20 12 17 5 4 22 42 29 1 13 41 2 48 36 8 9 45 49 44 10 31 24 14 34 27 6 3 30 38 28 7 26 33 46 16 
14 4 11 45 22 30...

result:

ok correct

Test #60:

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

input:

20000
5
569082 996527 2
133522 791438 2
212718 422423 2
946931 133687 2
970595 415128 1
5
475161 234214 1
276266 910552 2
458540 817460 2
21970 710977 2
60318 202464 1
5
335382 950413 1
370364 738034 1
941829 619601 2
680309 154224 2
993329 267917 1
5
835176 877061 2
672732 705523 2
301939 52590 2
3...

output:

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

result:

ok correct

Test #61:

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

input:

10000
10
26982 672280 1
782598 809490 2
235754 606744 1
42256 438007 1
292145 382166 2
466607 990010 1
434877 547137 1
873324 850229 2
844774 425355 1
130621 429161 1
10
579222 103366 2
826782 61438 2
313541 21820 2
388912 451197 1
18097 940244 1
935826 118218 2
938400 902754 1
122238 870886 1
25129...

output:

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

result:

ok correct

Test #62:

score: 0
Accepted
time: 91ms
memory: 3884kb

input:

5000
20
656459 452834 1
778773 545163 2
572641 540900 1
842346 965047 1
740062 319785 1
897329 270273 1
582655 610886 2
219885 724612 1
302339 486873 2
617143 729032 1
522655 412953 2
661512 656038 1
846755 641762 1
587397 69311 2
611884 874240 1
626444 442462 1
190156 648572 1
115134 369706 2
29791...

output:

17 8 15 10 4 18 9 7 2 11 19 14 12 13 3 1 16 5 6 20 
11 14 4 17 8 5 12 9 16 18 3 10 1 7 13 6 2 15 20 19 
2 1 12 20 5 10 4 13 19 3 7 11 18 17 15 16 9 8 14 6 
16 6 4 9 17 3 20 13 2 8 7 19 14 15 18 12 5 10 11 1 
6 14 15 3 18 8 19 9 1 5 10 2 16 4 17 7 11 13 20 12 
5 18 17 9 10 7 12 14 6 15 13 16 19 8 3 1...

result:

ok correct

Test #63:

score: 0
Accepted
time: 123ms
memory: 3888kb

input:

2000
50
801788 51391 2
351619 948789 1
452484 408774 1
51129 420086 2
308005 487650 1
124087 526739 1
834500 59027 2
194160 315058 1
801114 736832 2
399013 371746 2
385656 182930 2
165701 991455 1
960191 403475 2
893252 666759 2
519327 124615 2
408698 349786 2
71504 787913 2
28414 641975 2
694670 33...

output:

33 42 6 12 8 43 46 5 2 30 18 4 17 27 24 45 31 34 36 9 14 35 50 39 13 10 16 29 38 44 11 15 20 49 7 1 21 40 48 22 23 3 19 28 37 47 25 41 32 26 
20 3 22 9 24 1 25 42 4 32 50 15 11 28 37 10 47 30 26 35 49 13 43 36 34 48 29 8 21 5 39 19 18 14 33 44 46 17 12 45 27 40 23 6 7 41 2 16 31 38 
36 47 31 43 1 2 ...

result:

ok correct

Test #64:

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

input:

20000
5
349635 545372 3
579595 140692 1
179577 639115 1
506674 394126 2
940918 984665 1
5
722719 738832 1
340014 207497 2
332923 924970 1
83487 862401 1
360189 725288 3
5
644969 427979 1
932260 540143 1
529066 41164 3
41527 594517 2
151518 802371 3
5
159420 223873 1
418549 425477 2
543863 175684 3
3...

output:

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

result:

ok correct

Test #65:

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

input:

10000
10
31727 221125 2
485566 191447 2
202614 823436 1
602000 665743 2
262468 951703 2
714165 270437 2
531329 587186 1
747707 733546 1
938995 511372 1
397787 143474 2
10
888810 580932 3
197190 87739 2
900778 251895 1
7027 924193 1
176286 474698 1
260070 240838 1
651514 688117 1
621058 218171 1
5601...

output:

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

result:

ok correct

Test #66:

score: 0
Accepted
time: 84ms
memory: 3960kb

input:

5000
20
693909 1678 3
224846 670224 1
506796 757592 2
402090 258190 3
934577 146219 3
144887 742187 3
646403 875127 3
61564 799418 2
396560 572889 1
917013 219152 1
864946 955927 3
31920 458147 1
466697 839133 3
205512 285412 1
770073 632887 2
917984 565082 1
870566 368527 2
613954 492800 3
606798 4...

output:

20 12 14 2 9 8 3 6 13 7 11 18 19 4 5 1 15 17 16 10 
3 18 8 4 14 12 10 9 5 17 16 6 1 11 20 13 2 7 19 15 
13 11 9 12 15 6 7 1 5 19 18 17 3 14 10 8 20 4 16 2 
2 3 7 10 15 1 9 5 13 8 6 18 20 14 11 4 19 16 12 17 
9 17 12 18 4 10 11 15 13 1 5 8 14 6 7 3 16 19 2 20 
15 2 6 5 12 18 1 20 10 8 14 4 7 9 19 13 ...

result:

ok correct

Test #67:

score: 0
Accepted
time: 123ms
memory: 3880kb

input:

2000
50
615046 600235 1
797692 265339 2
419343 592762 2
578169 647821 1
311033 281380 2
404349 774462 1
898248 323268 3
68543 389863 1
895335 47040 1
666180 53355 1
695243 693200 3
568813 793564 3
514725 600846 1
511367 882859 3
453324 659069 2
957134 696598 2
784617 349084 2
335747 765069 3
3557 65...

output:

27 8 32 6 40 13 25 4 42 43 30 3 15 34 26 45 19 23 20 21 49 18 36 14 12 31 11 7 35 50 46 39 16 28 17 5 2 41 22 47 1 44 29 48 37 33 24 38 10 9 
24 31 2 44 8 4 21 28 13 41 5 11 12 18 1 46 50 27 3 36 33 40 14 25 38 48 39 6 23 20 32 15 49 17 29 37 19 22 9 16 35 26 45 10 47 7 30 42 34 43 
44 43 25 24 30 4...

result:

ok correct

Test #68:

score: 0
Accepted
time: 68ms
memory: 3800kb

input:

20000
5
176714 866987 8
970424 587123 8
543873 900795 2
303735 987914 7
206471 672631 8
5
210436 849621 3
318549 305954 10
364088 427550 7
677022 911826 1
812166 209585 1
5
964959 657626 9
777446 86692 1
667433 482872 3
116227 897704 10
248172 660801 5
5
210984 419727 8
401670 717513 2
2280 924253 5...

output:

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

result:

ok correct

Test #69:

score: 0
Accepted
time: 66ms
memory: 3892kb

input:

10000
10
654597 1459 1
923894 64902 6
262691 89248 7
358150 529230 3
901567 123793 5
980560 157661 6
959273 29856 6
325206 172317 3
949939 807372 2
838311 199219 4
10
233366 644854 1
190169 67417 7
501578 335259 6
659916 99903 7
932832 768340 8
532637 341539 2
933923 478859 10
860009 41454 1
838192 ...

output:

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

result:

ok correct

Test #70:

score: 0
Accepted
time: 91ms
memory: 3812kb

input:

5000
20
766765 821573 7
47152 486191 5
741809 250793 2
494657 103682 2
520073 351787 1
370366 397813 2
791833 85547 6
252430 700149 5
183656 1352 8
475996 193241 2
42735 344261 7
437697 193963 10
846433 698102 1
368303 134199 2
14203 150831 2
781792 422164 10
257358 840878 1
228671 452400 4
994250 6...

output:

17 15 6 18 2 8 11 1 16 12 9 7 19 20 3 10 14 4 13 5 
11 16 13 4 17 3 14 2 5 19 12 15 20 7 1 8 6 10 18 9 
19 12 10 15 13 4 9 3 8 16 14 5 1 18 2 17 6 7 20 11 
3 5 16 15 17 13 14 20 4 8 11 2 10 12 1 19 7 9 18 6 
11 17 2 19 8 6 7 12 18 10 4 9 16 14 13 1 20 15 5 3 
9 4 19 17 5 20 15 3 6 8 1 16 12 18 7 14 ...

result:

ok correct

Test #71:

score: 0
Accepted
time: 123ms
memory: 3892kb

input:

2000
50
551654 768124 8
1249 880873 9
594844 861509 4
62962 285279 1
473702 685496 2
955461 566652 1
387626 514638 4
389108 797436 3
365897 998974 5
683773 983820 8
246649 732082 10
956088 382116 10
563431 660549 5
367385 171681 8
66828 522496 7
594665 210534 6
68879 735446 5
558849 428341 7
462426 ...

output:

20 27 4 46 5 48 8 50 24 7 3 17 9 13 41 29 23 15 49 39 33 1 10 2 40 25 42 32 11 35 31 12 21 14 30 26 18 37 16 47 45 38 34 43 44 19 22 28 36 6 
8 14 18 4 44 17 32 7 43 31 45 9 16 39 41 25 10 22 27 19 5 42 3 30 1 48 34 11 46 47 2 15 50 6 20 21 13 33 23 40 28 29 35 12 26 24 36 49 37 38 
37 25 30 16 5 43...

result:

ok correct

Test #72:

score: 0
Accepted
time: 67ms
memory: 3820kb

input:

20000
5
669470 534462 55
468298 187490 100
206893 758201 69
258186 362898 8
533447 698201 12
5
206835 442012 95
883357 22359 38
289734 685854 60
377434 953917 12
563132 774370 51
5
76922 747947 92
275788 403255 42
514858 886474 19
715680 871956 43
223330 516686 67
5
779987 911593 14
190719 43058 93
...

output:

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

result:

ok correct

Test #73:

score: 0
Accepted
time: 66ms
memory: 3952kb

input:

10000
10
536810 992362 99
761609 28053 47
155415 748533 83
494319 201328 24
91475 19752 47
405485 466162 99
655008 213674 23
444509 133342 33
525286 809425 82
613071 844672 49
10
666397 767595 49
297808 635481 42
221693 225482 46
315261 837455 15
565352 574158 82
267913 12243 79
862997 308727 33
131...

output:

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

result:

ok correct

Test #74:

score: 0
Accepted
time: 93ms
memory: 3872kb

input:

5000
20
886064 846032 53
945597 832741 20
224366 85420 50
96560 34122 68
339197 691861 74
702430 864180 54
762518 137259 72
530525 447199 16
272302 234286 4
899149 331194 15
468506 711028 40
527883 470211 47
470498 791400 84
882420 970532 37
655267 135242 83
796380 478669 23
986091 751971 47
491854 ...

output:

14 11 6 5 13 19 15 7 4 1 3 17 12 18 16 2 8 10 9 20 
19 3 20 6 1 4 8 9 16 10 7 14 18 15 2 13 17 5 11 12 
4 18 16 14 3 7 12 1 19 9 5 2 13 17 8 10 6 11 20 15 
9 17 7 18 1 14 20 11 13 5 16 6 19 10 12 15 3 4 8 2 
14 1 6 18 3 2 5 9 20 7 16 4 17 11 15 10 12 19 8 13 
9 13 12 20 17 11 10 16 4 15 3 7 2 5 14 1...

result:

ok correct

Test #75:

score: 0
Accepted
time: 124ms
memory: 3884kb

input:

2000
50
709633 767169 14
530265 372883 38
38389 997966 21
286260 434393 3
339261 68316 31
303664 123642 20
828150 356401 13
526558 421474 50
934152 733061 67
205768 145769 22
131728 606733 18
218108 7104 59
567184 872132 96
518487 276387 85
695702 75389 61
830164 485115 47
836458 633318 88
282069 12...

output:

4 1 40 11 43 3 49 35 50 47 27 30 22 25 41 33 36 34 29 13 18 17 32 14 48 42 37 21 9 39 15 38 12 19 8 28 16 24 45 2 5 20 31 10 46 6 23 44 7 26 
24 47 26 27 7 14 12 25 39 22 17 16 44 34 42 19 29 8 50 36 23 15 38 6 37 43 30 31 49 4 32 21 48 45 41 3 40 18 13 10 1 35 33 2 11 20 5 28 46 9 
23 29 3 14 34 22...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed