QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#449921#7750. Revenge on My BossamogusususAC ✓2395ms18580kbC++143.1kb2024-06-21 19:18:112024-06-21 19:18:11

Judging History

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

  • [2024-06-21 19:18:11]
  • 评测
  • 测评结果:AC
  • 用时:2395ms
  • 内存:18580kb
  • [2024-06-21 19:18:11]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
vector <int> res,tmp,tmp2;
vector <pair <int, int>> ve,ve2;
int t,n,a[100001],b[100001],c[100001],sumb;
pair <int, int> st[400001];
void build(int node, int l, int r){
    if (l==r){
        int i=ve[l].second;
        st[node]={a[i]-b[i],l};
        return;
    }
    int mid=(l+r)>>1;
    build(node<<1,l,mid);
    build(node<<1|1,mid+1,r);
    st[node]=min(st[node<<1],st[node<<1|1]);
}
void update(int node, int l, int r, int i){
    if (l>i||r<i)
        return;
    if (l==r){
        st[node].first=1e9;
        return;
    }
    int mid=(l+r)>>1;
    update(node<<1,l,mid,i);
    update(node<<1|1,mid+1,r,i);
    st[node]=min(st[node<<1],st[node<<1|1]);
}
pair <int, int> get(int node, int l, int r, int u, int v){
    if (l>v||r<u||l>r)
        return {1e9,0};
    if (l>=u&&r<=v)
        return st[node];
    int mid=(l+r)>>1;
    return min(get(node<<1,l,mid,u,v),get(node<<1|1,mid+1,r,u,v));
}
bool check(int x){
    tmp.clear();
    tmp2.clear();
    ve.clear();
    ve2.clear();
    for (int i=1;i<=n;i++){
        int lim=x/c[i]-sumb-a[i];
        if (a[i]<=b[i])
            ve.push_back({lim,i});
        else
            ve2.push_back({lim+a[i]-b[i],i});
    }
    sort(ve.begin(),ve.end());
    sort(ve2.begin(),ve2.end());
    int cur=0;
    if (!ve.empty()){
        build(1,0,ve.size()-1);
        while (true){
            int i=lower_bound(ve.begin(),ve.end(),make_pair(cur,-1LL))-ve.begin();
            auto [x,y]=get(1,0,ve.size()-1,i,ve.size()-1);
            if (x>1e6)
                break;
            update(1,0,ve.size()-1,y);
            y=ve[y].second;
            cur+=a[y]-b[y];
            tmp.push_back(y);
        }
        if (tmp.size()<ve.size())
            return false;
    }
    for (auto [i,j]:ve2)
        cur+=a[j]-b[j];
    swap(ve,ve2);
    if (!ve.empty()){
        build(1,0,ve.size()-1);
        while (true){
            int i=lower_bound(ve.begin(),ve.end(),make_pair(cur,-1LL))-ve.begin();
            auto [x,y]=get(1,0,ve.size()-1,i,ve.size()-1);
            if (x>1e6)
                break;
            update(1,0,ve.size()-1,y);
            y=ve[y].second;
            cur+=b[y]-a[y];
            tmp2.push_back(y);
        }
        if (tmp2.size()<ve.size())
            return false;
    }
    res.clear();
    for (int i:tmp)
        res.push_back(i);
    reverse(tmp2.begin(),tmp2.end());
    for (int i:tmp2)
        res.push_back(i);
    return true;
}
void solve(){
    cin >> n;
    sumb=0;
    for (int i=1;i<=n;i++){
        cin >> a[i] >> b[i] >> c[i];
        sumb+=b[i];
    }
    int l=0,r=1e18,kq=-1;
    res.clear();
    while (l<=r){
        int mid=(l+r)>>1;
        if (check(mid)){
            kq=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    for (int i:res)
        cout << i << ' ';
    cout << '\n';
}
int32_t main(){
    ios_base::sync_with_stdio(NULL);cin.tie(nullptr);
    cin >> t;
    while (t--)
        solve();
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 2 4 5 7 1 6 9 

result:

ok correct

Test #2:

score: 0
Accepted
time: 1469ms
memory: 11800kb

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 77582 77581 82112 72163 18220 43645 30468 80107 54173 17444 14872 8630 50133 26305 35 70096 40298 10072 56385 75312 79444 19284 81622 95793 96892 82320 8443 11434 56765 72103 89089 86041 48305 32033 88191 83243 9383 66880 81866 31386 23642 79775 66240 99937 38682 18931 39524 48449 36540 202 11...

result:

ok correct

Test #3:

score: 0
Accepted
time: 1698ms
memory: 13712kb

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:

11258 2014 71474 6532 89436 65068 47750 70417 79857 12956 68243 43016 12061 58424 14146 76212 48267 28786 37433 26941 97091 5811 25880 29667 49639 53925 51067 45765 35831 93900 12972 7028 92312 21851 10387 35976 17613 69792 36607 32905 38051 15744 66643 51156 90652 31627 58121 50418 29341 27066 7374...

result:

ok correct

Test #4:

score: 0
Accepted
time: 1778ms
memory: 13832kb

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:

80527 3809 12335 45342 87018 63708 426 87540 76853 61088 98415 90458 82606 10314 15291 83841 85026 13737 25931 27735 92451 8426 99454 30563 97443 1919 72529 15335 82314 97073 17722 61512 92797 58724 75478 95618 54244 10187 32858 30240 9896 35619 7138 62032 51960 51306 8408 49950 59591 71738 85212 88...

result:

ok correct

Test #5:

score: 0
Accepted
time: 1771ms
memory: 13900kb

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:

36392 64338 66743 87839 71032 23583 3112 4830 49001 88104 77082 50042 89752 28311 58537 35627 96232 705 97752 83578 74339 22777 34740 17872 99481 75094 68681 92662 93861 97537 14496 3440 43772 7546 81299 72816 74382 45345 53032 47638 3385 455 5435 39843 56880 16923 23430 85634 91713 69807 96904 3999...

result:

ok correct

Test #6:

score: 0
Accepted
time: 1794ms
memory: 11832kb

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:

40394 63496 37670 77344 75717 92481 81446 57804 37848 11663 3990 57699 47208 53240 59015 89693 33971 15655 33683 27505 68379 72145 12260 13924 89438 58373 94057 25588 72087 89793 13726 5342 3419 15893 84263 30806 22062 60315 91031 83092 48135 36453 355 44090 66379 78769 1780 29823 22824 36866 58484 ...

result:

ok correct

Test #7:

score: 0
Accepted
time: 1851ms
memory: 13840kb

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:

84025 77469 42297 2181 78261 91806 94750 64717 75025 3114 95971 28646 69732 91045 54239 26813 18776 28166 81760 82802 86869 63806 50747 42695 69293 61448 72042 88050 49475 45745 99505 25716 88850 74576 43316 40348 79245 72894 25754 57550 90429 46724 59301 62096 64273 4365 30124 87945 23641 53625 917...

result:

ok correct

Test #8:

score: 0
Accepted
time: 2122ms
memory: 13856kb

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:

16345 23726 48658 97376 13958 33981 16515 99206 8777 9778 62663 8704 10342 57114 18957 27327 1468 4655 18474 60140 73478 78090 71606 1647 91390 96365 69898 66704 36648 40033 43652 81409 54705 6305 11952 67165 8664 79837 45085 86903 10471 98106 50874 41275 21736 97281 99413 57069 67072 29002 69852 26...

result:

ok correct

Test #9:

score: 0
Accepted
time: 2047ms
memory: 13868kb

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:

2660 24253 73226 83405 18252 14431 7506 70526 83640 75154 26554 10196 88133 18483 50212 44446 21302 48272 17218 89535 21172 32778 89955 92483 85572 99884 62026 65895 7906 22462 99755 66509 1849 86624 66871 46301 14233 53747 93698 83434 25123 80529 75827 75263 18607 52069 10593 10334 63789 68241 5060...

result:

ok correct

Test #10:

score: 0
Accepted
time: 2082ms
memory: 13860kb

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:

20687 86448 11487 61198 75272 94703 98367 53545 59504 35104 43296 80971 48750 96396 56575 52240 44891 25095 24065 22547 76449 27516 69565 96441 3737 32045 37906 14829 84805 52382 70665 67618 80988 49349 17933 9710 48270 79592 67311 63503 10796 50363 91857 18981 66113 82793 542 72293 26943 16459 1479...

result:

ok correct

Test #11:

score: 0
Accepted
time: 1933ms
memory: 13864kb

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:

48738 37593 9304 42762 27286 79279 7563 22369 24030 9219 17663 32296 34187 54533 12654 38568 38233 61401 32852 96024 41324 58544 9476 29991 52563 45582 64041 21137 14021 62235 85717 35358 26871 34890 38628 9939 19876 62151 64974 31375 75862 19102 28376 37679 22555 55192 39414 64815 42960 45399 18507...

result:

ok correct

Test #12:

score: 0
Accepted
time: 1869ms
memory: 13808kb

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:

98477 30104 46304 96255 38201 25324 98016 74157 38616 62178 92277 26372 12771 91261 12915 6090 23476 62518 75300 73158 59901 26631 11117 10277 35613 36940 55483 40696 37860 69614 68277 68645 2984 41392 68986 65026 38646 76 31869 44948 85693 87404 79586 65541 54849 60818 63797 28254 53003 64853 78667...

result:

ok correct

Test #13:

score: 0
Accepted
time: 2120ms
memory: 13824kb

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:

35042 10651 45487 29458 55995 99342 23069 50546 28322 45552 37619 77956 68601 33757 5980 46682 24248 13614 24087 26139 41288 3388 6453 86816 29522 28020 47638 62100 73231 10323 72178 69411 74265 8432 81157 15247 54585 1659 37469 46303 15877 64116 86578 25211 23403 38950 56386 4709 21320 28714 51651 ...

result:

ok correct

Test #14:

score: 0
Accepted
time: 2107ms
memory: 13996kb

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:

10155 97756 80001 37508 1116 82750 8186 52239 25575 76715 21202 50969 9305 82567 42896 99094 97488 47968 79081 76513 88291 38359 90708 82452 71919 21728 17316 65253 54080 67445 45433 15767 26568 69715 64285 56082 72382 44516 73364 10429 48993 51963 34067 75868 1561 29762 62635 24082 94541 28453 3322...

result:

ok correct

Test #15:

score: 0
Accepted
time: 2057ms
memory: 13736kb

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:

49220 96124 69628 83872 3045 8350 61264 90096 32888 17423 60516 68162 90393 68219 73770 174 63279 4539 60500 31089 18314 12340 21173 18268 87957 30828 58507 87379 51369 60223 65390 87803 84067 87159 26252 67987 51603 36814 77736 79651 84814 29105 2067 69506 3679 50315 17003 45601 9992 20111 15627 14...

result:

ok correct

Test #16:

score: 0
Accepted
time: 1825ms
memory: 13904kb

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:

58494 53051 31756 72116 15139 89735 5535 51597 94720 79088 33202 69349 9771 96532 16266 99542 43078 48093 37026 92057 65225 30022 92127 36827 45961 57646 48425 64541 36798 39540 67674 6796 40383 96171 56108 51422 6793 96350 46934 75656 76664 86573 41137 3768 92638 7008 70688 99553 47574 38806 79008 ...

result:

ok correct

Test #17:

score: 0
Accepted
time: 1794ms
memory: 13940kb

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:

72777 20649 35030 77452 99776 57979 76292 70093 69641 86097 23236 29765 59190 44867 44526 89799 7149 54429 74584 25474 9074 93330 32769 58672 25736 34517 35588 91038 8394 77204 75068 76622 95579 86125 91797 77055 48310 7309 63018 31854 78350 10072 49579 92227 52630 48498 91165 88512 35719 38114 3804...

result:

ok correct

Test #18:

score: 0
Accepted
time: 2140ms
memory: 13884kb

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:

76639 65200 4989 56294 74558 62188 93882 3555 60914 19920 10946 10459 38047 50770 16453 47626 65982 262 86040 8915 53647 9168 18483 9415 52679 57420 30096 2033 88800 786 4514 48034 2233 89082 37297 28885 24087 73831 89704 76650 61535 1054 1340 76350 58458 42428 38680 90201 79946 34246 24080 88655 10...

result:

ok correct

Test #19:

score: 0
Accepted
time: 2092ms
memory: 13880kb

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:

9262 1693 16443 49840 43976 1356 93322 89793 20920 30594 76388 5568 45732 7486 58302 72833 77772 73666 57803 69203 33260 24342 22217 22797 82847 10612 48650 39267 18228 35920 12435 37658 88454 10189 97067 2848 82605 27841 13433 87927 99728 4592 55231 23482 36970 81622 71813 19835 27387 88156 19973 5...

result:

ok correct

Test #20:

score: 0
Accepted
time: 1824ms
memory: 13796kb

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:

59939 70536 55684 12726 97058 188 7627 97402 5421 53701 96798 1846 91216 94835 94331 34527 75501 20392 92042 77140 2453 36204 62071 5251 39209 52319 21577 4083 81667 12772 3792 75969 2739 60853 42196 4149 63797 29638 90798 52190 26264 89664 2435 92198 78923 5418 73366 66766 37684 17841 94083 91403 9...

result:

ok correct

Test #21:

score: 0
Accepted
time: 2195ms
memory: 11848kb

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:

12024 11377 83782 24752 35497 9664 11942 42800 66672 62663 49932 26882 54738 76329 96351 569 48771 3491 68880 92448 25508 76115 11734 58485 20877 73764 17435 95209 30653 24503 84387 46258 91098 83904 18158 38390 67640 73699 72361 75364 80667 20665 25164 56290 25156 69135 55332 59250 7196 72263 72559...

result:

ok correct

Test #22:

score: 0
Accepted
time: 1928ms
memory: 13944kb

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:

21429 15322 50324 34892 54938 28712 26976 68322 15019 87173 21207 65841 7354 44948 65292 72601 87676 77588 65241 78015 64557 79555 26498 32776 7029 15481 17862 16986 23167 23057 85903 75670 94451 88739 93977 667 80033 32353 30977 16624 44050 51240 95736 46883 80299 18489 47526 27724 61033 74403 6964...

result:

ok correct

Test #23:

score: 0
Accepted
time: 1965ms
memory: 13928kb

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:

31035 70788 43027 14866 55403 50103 1733 83858 64809 310 37462 86999 48196 81845 46808 44577 73437 95065 87573 40826 44977 81331 67594 17269 62360 24087 1665 1992 636 65525 543 38342 21544 11071 28069 71443 81551 40767 44405 44973 7895 27859 30018 70036 70372 12191 6365 73961 31038 85290 66769 69475...

result:

ok correct

Test #24:

score: 0
Accepted
time: 2028ms
memory: 13940kb

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:

29239 43368 65062 67953 53357 88299 33846 26831 74656 40424 38331 23453 30223 88114 87279 29860 14054 2126 78035 63174 25960 67286 21587 63821 91274 32774 88241 13171 3482 22678 3110 98211 48000 10875 24758 72762 54244 536 16671 94586 59462 72857 73245 2712 87634 81514 23291 52244 24078 61992 65916 ...

result:

ok correct

Test #25:

score: 0
Accepted
time: 2170ms
memory: 13908kb

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:

70859 99351 61506 86644 38407 80900 42874 66655 5816 80173 22065 68748 71615 82635 53799 35117 33498 78325 97055 6178 77943 73686 51822 9696 60338 44913 53830 87924 79277 98967 23411 21935 18375 27984 67762 27615 1180 18982 5680 25451 67682 42157 56026 45594 48080 36025 93178 14209 91927 87046 46512...

result:

ok correct

Test #26:

score: 0
Accepted
time: 2214ms
memory: 13932kb

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:

14672 77062 55989 85426 5835 7472 66961 54425 5712 8019 20822 79314 42117 16074 57252 35946 55326 61968 82829 35696 90251 30078 16859 45790 67928 71713 92337 66570 89487 72262 40322 66785 92050 52956 59247 58772 6113 12369 3741 55104 28174 68957 37284 93828 44902 38661 14867 3780 64364 26135 96554 5...

result:

ok correct

Test #27:

score: 0
Accepted
time: 1929ms
memory: 14000kb

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:

88571 31644 28633 61646 18266 78744 54794 70894 34144 17586 48983 39231 61588 11248 42791 91894 67782 82213 51764 66742 55849 83111 8285 51020 25650 2048 57396 45005 87879 8709 92695 28740 78983 30277 40128 10803 46688 65173 18603 75009 11282 20409 83708 97528 63374 62241 88852 7103 12849 16186 7570...

result:

ok correct

Test #28:

score: 0
Accepted
time: 2116ms
memory: 13956kb

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:

33638 64958 71822 52632 16419 33283 62741 15760 91380 9442 86014 76629 39110 34799 99746 91687 54790 95351 88398 93849 12489 50796 45252 2611 64194 13020 59657 12213 63952 23757 67169 55965 22039 40159 72472 42716 21254 68147 99726 9580 80491 88891 42421 43960 13509 68356 56014 61890 87819 21944 325...

result:

ok correct

Test #29:

score: 0
Accepted
time: 2023ms
memory: 13928kb

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:

65168 92025 69097 8246 55072 22197 30355 67342 81956 4484 42802 44979 14574 65487 39569 75883 32212 59993 57971 76982 58872 99181 70986 63531 88454 13431 58138 46829 65873 82 85253 1670 28463 48451 9766 84977 94023 21412 97159 44092 46267 26279 13168 914 39615 65248 66403 97143 43331 89002 37577 165...

result:

ok correct

Test #30:

score: 0
Accepted
time: 2383ms
memory: 14008kb

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:

82029 76108 79242 33511 35308 24437 1622 1355 57008 81297 13419 93289 4636 85379 77287 64323 86009 11153 63703 4274 22811 83646 34216 28051 28606 35277 1305 3895 83457 58156 65798 98589 88297 85843 38952 12449 2126 98967 58126 80298 18349 55373 87559 52810 34244 92569 96667 83161 77389 15712 22523 4...

result:

ok correct

Test #31:

score: 0
Accepted
time: 2129ms
memory: 13772kb

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:

40572 2733 17944 52195 58932 48436 79830 13728 99888 65713 47770 31127 43640 14219 76910 49079 18032 28051 42691 32277 66048 92580 3540 87450 23308 17320 90335 37591 91043 39481 82430 81446 37424 47351 23862 67104 79681 53555 57277 15822 32682 50992 57694 78548 17633 48796 59933 29404 40470 77478 42...

result:

ok correct

Test #32:

score: 0
Accepted
time: 595ms
memory: 18580kb

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:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 ...

result:

ok correct

Test #33:

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

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 8 2 9 4 5 6 3 7 10 

result:

ok correct

Test #34:

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

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 4 1 9 3 2 6 7 8 

result:

ok correct

Test #35:

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

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:

152 69 70 430 109 36 80 146 336 463 244 472 153 469 497 344 211 450 500 343 437 359 63 498 221 449 480 94 428 371 239 253 323 228 377 53 348 98 140 241 208 198 355 54 141 262 326 405 227 435 468 330 91 93 134 478 487 275 225 103 230 217 61 294 408 159 212 310 174 390 89 392 426 490 139 327 185 56 37...

result:

ok correct

Test #36:

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

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:

31 99 326 406 213 63 39 330 342 256 428 460 92 362 464 260 473 7 347 77 135 12 307 335 429 282 383 421 299 267 111 489 53 208 251 97 58 209 144 318 281 230 277 359 405 156 495 41 188 262 448 202 324 72 465 415 219 183 339 491 104 447 492 303 440 81 18 90 354 493 64 455 348 128 13 10 50 203 205 472 1...

result:

ok correct

Test #37:

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

input:

1
1
1 1 1

output:

1 

result:

ok correct

Test #38:

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

input:

1
1
796328 1 719733

output:

1 

result:

ok correct

Test #39:

score: 0
Accepted
time: 2375ms
memory: 13804kb

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:

53741 2976 96267 8603 61077 24073 66821 38116 67733 37059 97370 24270 19825 54206 40074 57922 73068 5021 60628 50176 89376 39107 91418 15630 32601 95079 97545 68448 9382 6901 96731 60305 98325 66270 35245 83501 7592 7147 12350 38897 47239 98704 127 95773 27941 2607 76922 11454 55988 824 57395 777 12...

result:

ok correct

Test #40:

score: 0
Accepted
time: 2395ms
memory: 13920kb

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:

82877 23310 58470 54476 2213 52682 38634 13081 79718 46137 36797 23713 98533 77380 65334 63849 19971 27913 16766 49056 19472 72634 68800 94475 18554 4072 96360 3074 82162 32134 86700 94754 23772 36511 21741 755 90413 99039 92255 22788 74780 9036 61835 55582 67504 65854 93783 3179 18054 55836 88604 3...

result:

ok correct

Test #41:

score: 0
Accepted
time: 1437ms
memory: 13024kb

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:

42115 24101 23735 7021 8043 566 46978 35378 51305 54439 1665 48870 56705 54399 38278 33737 58168 48673 21529 41948 38704 19376 16663 59262 58609 26114 43708 7238 37001 61776 15974 16386 48606 40565 10951 41999 26331 20959 16021 51014 45818 64050 52019 67428 53404 10742 51576 51221 67837 55685 12517 ...

result:

ok correct

Test #42:

score: 0
Accepted
time: 577ms
memory: 5908kb

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 225 194 58 23 53 199 242 229 111 122 68 224 50 28 137 207 91 86 70 65 109 146 178 72 135 39 223 69 142 129 239 75 212 128 186 63 154 54 237 219 221 108 249 227 37 119 29 168 32 164 27 67 48 240 85 38 59 234 155 160 105 126 244 115 56 235 211 253 200 243 153 136 187 107 247 220 73 205 252 11 245 ...

result:

ok correct

Test #43:

score: 0
Accepted
time: 235ms
memory: 5712kb

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 8 7 11 12 2 5 10 1 4 13 6 3 
1 
1 3 4 6 2 5 
7 4 8 2 5 6 1 3 9 
1 
1 2 3 5 6 4 
7 6 1 5 2 4 3 
12 8 5 11 19 2 16 6 20 15 13 18 23 10 1 14 9 17 21 22 3 7 24 4 
8 11 5 4 6 10 12 2 9 3 7 1 
8 16 17 25 6 10 11 14 15 7 4 9 18 12 21 20 22 5 24 2 3 23 1 13 19 
2 7 11 8 1 5 9 10 3 13 6 4 12 
12 9 2 8 1...

result:

ok correct

Test #44:

score: 0
Accepted
time: 733ms
memory: 9388kb

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:

2614 3507 1662 2859 1009 2924 1675 1260 2278 3658 664 2544 2133 2915 29 3094 1376 3883 978 1362 1432 2883 3123 1273 2255 3465 280 1330 2565 1515 2902 256 2829 3574 3324 2882 1123 1393 3570 3946 2417 3510 1506 1488 3312 1964 429 2947 3147 3598 3175 2307 2541 1211 1494 423 51 3520 1914 2635 3286 8 371...

result:

ok correct

Test #45:

score: 0
Accepted
time: 655ms
memory: 5860kb

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:

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

result:

ok correct

Test #46:

score: 0
Accepted
time: 251ms
memory: 5764kb

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

result:

ok correct

Test #47:

score: 0
Accepted
time: 28ms
memory: 5860kb

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:

204 848 282 1319 1158 1067 1367 1147 104 908 686 261 267 831 408 715 1200 1389 350 190 381 504 825 1010 1027 471 1272 1072 834 721 334 167 177 72 734 1205 947 85 1273 1299 861 1074 28 974 748 1308 24 112 74 1128 628 1348 775 275 747 1151 1184 833 517 594 459 1111 521 1190 1110 155 776 45 158 1321 57...

result:

ok correct

Test #48:

score: 0
Accepted
time: 718ms
memory: 5768kb

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:

136 202 215 174 183 104 72 67 24 225 158 169 23 122 139 7 180 205 194 200 62 178 60 238 25 40 88 37 248 152 176 84 182 193 111 208 164 115 153 90 196 192 63 125 26 61 128 218 224 51 131 28 217 227 244 15 166 188 57 56 191 114 228 133 102 232 81 210 22 168 116 223 75 236 76 189 142 108 38 203 65 172 ...

result:

ok correct

Test #49:

score: 0
Accepted
time: 257ms
memory: 5684kb

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:

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

result:

ok correct

Test #50:

score: 0
Accepted
time: 999ms
memory: 9152kb

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:

1951 1528 1802 80 237 920 1343 2492 1834 2144 2277 689 536 935 1559 97 2627 2021 2687 1811 233 1037 686 2303 372 1004 1337 2148 786 316 853 270 2677 1650 468 57 1759 507 185 82 1832 1415 819 2552 2471 381 2457 2414 1414 2035 469 2425 423 449 2098 983 151 841 295 714 1323 2587 2490 948 1432 873 1250 ...

result:

ok correct

Test #51:

score: 0
Accepted
time: 731ms
memory: 5928kb

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:

280 303 309 234 26 230 129 135 146 293 70 277 282 122 182 73 75 20 48 1 29 265 291 157 130 246 313 57 90 166 159 12 312 290 206 271 89 76 107 156 250 164 279 205 227 179 226 221 54 169 62 84 217 35 88 109 252 137 13 5 257 247 216 305 42 37 25 278 145 61 77 118 220 284 183 72 211 260 111 103 273 244 ...

result:

ok correct

Test #52:

score: 0
Accepted
time: 272ms
memory: 7748kb

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

result:

ok correct

Test #53:

score: 0
Accepted
time: 1580ms
memory: 8544kb

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:

12893 699 44890 13784 14631 11829 17581 16313 11949 18774 42636 11303 11344 29062 40707 41907 27073 1556 23118 11432 31478 894 10099 45812 26404 36096 39095 25433 29855 42122 24484 8786 15799 40275 13294 44259 20512 2391 47661 27812 1386 44156 20701 13326 42650 120 30324 36010 25947 34757 22386 2650...

result:

ok correct

Test #54:

score: 0
Accepted
time: 786ms
memory: 5820kb

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:

326 176 204 228 333 275 142 389 203 413 16 193 30 123 258 331 184 399 371 317 59 246 56 3 276 308 2 75 354 364 9 172 343 22 98 170 132 32 288 225 286 230 328 107 327 50 244 10 46 372 217 82 36 99 8 48 110 292 194 269 279 369 11 79 85 169 84 261 283 150 153 388 266 358 313 249 14 26 284 146 398 197 1...

result:

ok correct

Test #55:

score: 0
Accepted
time: 273ms
memory: 7668kb

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:

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

result:

ok correct

Test #56:

score: 0
Accepted
time: 191ms
memory: 5696kb

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 5 2 4 
4 1 3 5 2 
5 1 4 3 2 
1 5 3 2 4 
1 2 5 4 3 
2 1 5 4 3 
1 3 2 5 4 
5 2 3 1 4 
4 2 5 1 3 
2 4 3 5 1 
2 3 4 5 1 
5 4 2 3 1 
4 3 2 1 5 
2 4 1 5 3 
2 1 3 5 4 
1 4 5 3 2 
3 5 2 4 1 
4 5 2 3 1 
5 3 2 4 1 
5 3 4 2 1 
4 2 5 3 1 
4 1 5 2 3 
1 2 4 5 3 
3 1 5 4 2 
4 2 5 3 1 
1 2 3 4 5 
1 2...

result:

ok correct

Test #57:

score: 0
Accepted
time: 227ms
memory: 5708kb

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 2 5 3 4 6 1 7 10 9 
1 4 7 6 3 2 5 9 8 10 
1 3 9 7 10 5 6 2 4 8 
2 3 5 7 10 9 1 4 8 6 
3 2 6 7 4 5 9 1 8 10 
2 9 6 10 3 1 5 4 7 8 
1 8 6 10 3 2 5 9 7 4 
2 7 5 4 8 6 9 1 10 3 
3 4 8 7 6 1 5 10 9 2 
2 10 7 9 8 1 6 3 4 5 
5 3 4 2 1 8 9 6 10 7 
3 1 2 4 6 9 5 7 8 10 
1 3 8 2 7 10 5 4 6 9 
5 9 3 8 6 2 10...

result:

ok correct

Test #58:

score: 0
Accepted
time: 244ms
memory: 5696kb

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 4 8 13 2 1 7 19 18 17 6 15 14 11 5 20 3 16 9 10 
15 2 14 20 5 18 13 6 16 17 10 19 12 4 1 3 9 7 8 11 
9 18 6 1 7 14 15 16 11 17 19 2 8 12 4 10 13 20 5 3 
9 1 7 15 4 20 8 12 6 5 18 14 16 13 11 10 17 3 19 2 
9 1 13 16 14 12 19 15 11 3 5 10 17 4 18 7 6 8 2 20 
1 8 13 7 18 20 17 4 5 3 2 19 16 15 11 6 ...

result:

ok correct

Test #59:

score: 0
Accepted
time: 287ms
memory: 5708kb

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

result:

ok correct

Test #60:

score: 0
Accepted
time: 199ms
memory: 5776kb

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 1 3 4 5 
5 4 2 3 1 
1 2 3 4 5 
4 1 2 5 3 
5 3 1 4 2 
1 3 4 2 5 
2 1 5 4 3 
3 4 5 2 1 
3 5 4 1 2 
2 4 3 5 1 
1 2 5 3 4 
2 3 4 1 5 
1 3 2 5 4 
1 2 3 4 5 
2 5 4 3 1 
5 3 4 2 1 
1 5 4 2 3 
1 2 3 4 5 
1 2 5 4 3 
4 5 2 3 1 
3 1 4 2 5 
4 3 1 2 5 
5 4 1 2 3 
2 4 1 5 3 
3 5 4 1 2 
1 2 3 4 5 
2 5 3 4 1 
4 3...

result:

ok correct

Test #61:

score: 0
Accepted
time: 225ms
memory: 5708kb

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 6 4 3 10 7 5 2 8 9 
5 8 9 4 6 2 1 10 3 7 
1 8 9 3 2 7 5 6 4 10 
6 7 1 9 2 3 8 5 4 10 
1 9 10 3 6 2 8 7 5 4 
9 3 2 6 1 4 10 7 5 8 
4 2 3 5 10 6 7 1 9 8 
1 2 4 8 6 10 9 3 5 7 
5 2 10 6 4 1 7 9 8 3 
8 7 10 1 5 3 2 4 9 6 
2 6 3 8 9 10 1 4 7 5 
7 4 6 10 8 3 5 9 1 2 
6 10 9 3 2 8 5 1 4 7 
9 8 10 1 3 6 7...

result:

ok correct

Test #62:

score: 0
Accepted
time: 266ms
memory: 5648kb

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:

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

result:

ok correct

Test #63:

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

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:

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

result:

ok correct

Test #64:

score: 0
Accepted
time: 200ms
memory: 5648kb

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 2 4 
4 3 1 5 2 
4 5 3 2 1 
1 2 3 4 5 
4 2 3 5 1 
4 1 5 3 2 
1 4 3 2 5 
1 3 4 2 5 
4 1 3 2 5 
5 3 1 2 4 
4 3 2 5 1 
3 5 2 4 1 
4 1 3 2 5 
3 5 2 1 4 
1 3 4 2 5 
4 2 1 3 5 
2 5 4 1 3 
5 4 1 2 3 
3 2 5 1 4 
2 1 5 4 3 
4 1 3 2 5 
5 3 1 2 4 
1 3 2 4 5 
2 5 4 3 1 
4 3 2 5 1 
5 1 3 2 4 
3 1 5 4 2 
5 4...

result:

ok correct

Test #65:

score: 0
Accepted
time: 236ms
memory: 5628kb

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 1 5 4 7 6 2 10 9 8 
4 5 7 1 3 8 9 2 10 6 
2 9 1 4 6 8 3 5 7 10 
5 6 2 9 3 7 10 8 4 1 
4 1 3 8 6 2 5 7 9 10 
2 10 5 1 7 8 6 4 9 3 
7 6 3 8 10 2 9 4 1 5 
3 5 6 2 4 7 8 10 1 9 
8 9 10 7 5 6 3 2 1 4 
1 3 8 10 2 7 9 6 5 4 
7 10 6 3 5 2 1 8 9 4 
4 5 7 9 2 10 8 6 1 3 
8 9 3 7 6 1 10 4 2 5 
2 8 3 7 6 10 5...

result:

ok correct

Test #66:

score: 0
Accepted
time: 269ms
memory: 5716kb

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:

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

result:

ok correct

Test #67:

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

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:

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

result:

ok correct

Test #68:

score: 0
Accepted
time: 198ms
memory: 5680kb

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 
1 4 3 2 5 
5 4 1 2 3 
3 2 1 5 4 
4 3 2 1 5 
1 5 4 2 3 
2 5 1 4 3 
3 5 1 4 2 
5 4 3 2 1 
1 2 5 4 3 
1 4 3 2 5 
1 4 3 5 2 
5 4 2 3 1 
2 1 5 4 3 
4 2 3 5 1 
2 1 5 3 4 
2 3 4 1 5 
1 5 3 4 2 
3 4 2 1 5 
2 3 5 4 1 
3 5 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: 235ms
memory: 5692kb

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 2 6 3 7 5 1 10 8 9 
10 1 7 5 8 4 2 9 6 3 
8 10 9 7 5 6 1 2 4 3 
4 9 1 2 10 6 8 5 3 7 
7 3 5 1 10 4 8 2 6 9 
8 1 3 10 5 2 4 9 7 6 
9 8 3 7 2 4 5 10 6 1 
3 2 1 7 10 4 6 5 8 9 
2 8 7 10 9 6 1 3 4 5 
2 6 3 4 10 9 7 8 1 5 
8 3 7 4 2 6 9 10 5 1 
7 6 8 1 9 10 5 4 2 3 
3 9 10 1 6 2 7 4 5 8 
4 7 9 2 3 6 1 ...

result:

ok correct

Test #70:

score: 0
Accepted
time: 284ms
memory: 5676kb

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 8 2 11 18 15 1 6 16 12 7 3 9 4 19 10 14 5 13 20 
14 17 11 3 16 13 2 4 5 19 12 15 9 10 18 6 20 7 8 1 
13 4 19 15 9 3 8 12 10 16 14 5 18 1 11 17 20 6 2 7 
3 14 13 17 16 5 20 15 4 8 11 10 2 6 9 19 12 1 7 18 
19 12 18 2 6 11 10 8 17 7 4 9 16 14 15 13 20 1 3 5 
19 5 20 17 4 9 15 3 6 8 16 1 18 12 11 14...

result:

ok correct

Test #71:

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

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:

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

result:

ok correct

Test #72:

score: 0
Accepted
time: 204ms
memory: 5756kb

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:

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

result:

ok correct

Test #73:

score: 0
Accepted
time: 241ms
memory: 5676kb

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 7 8 4 5 
4 2 1 8 5 3 9 10 7 6 
7 10 9 5 2 4 8 6 1 3 
5 3 6 2 9 7 8 1 10 4 
3 5 4 9 2 8 6 7 1 10 
9 8 10 6 3 2 4 7 5 1 
6 8 4 1 3 5 2 7 9 10 
9 5 1 6 3 4 10 7 8 2 
5 3 9 10 8 1 4 7 6 2 
1 9 7 6 4 10 2 8 3 5 
6 1 5 2 8 4 3 7 9 10 
5 2 7 4 3 10 8 9 1 6 
9 2 3 10 6 5 8 7 4 1 
2 8 4 10 5 7 6...

result:

ok correct

Test #74:

score: 0
Accepted
time: 287ms
memory: 5708kb

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:

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

result:

ok correct

Test #75:

score: 0
Accepted
time: 358ms
memory: 7796kb

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:

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

result:

ok correct

Extra Test:

score: 0
Extra Test Passed