QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#563687#9284. Christmas Children Circlezjy0001AC ✓81ms60320kbC++171.0kb2024-09-14 15:05:412024-09-14 15:05:45

Judging History

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

  • [2024-09-14 15:05:45]
  • 评测
  • 测评结果:AC
  • 用时:81ms
  • 内存:60320kb
  • [2024-09-14 15:05:41]
  • 提交

answer

#include<bits/stdc++.h>
#define LL long long
#define LLL __int128
#define uint unsigned
#define ldb long double
#define uLL unsigned long long
using namespace std;
const int N=5e5+5;
int n,rt=1;
int ans[N];
vector<int>A[N];
inline bool solve(int x,int y){
    ans[x]=y;
    if(x%n+1!=rt){
        if(binary_search(A[x%n+1].begin(),A[x%n+1].end(),y))
            return solve(x%n+1,y);
        else return solve(x%n+1,A[x%n+1][0]);
    }
    else{
        if(y==ans[rt])return 1;
        if(binary_search(A[x%n+1].begin(),A[x%n+1].end(),y))return 0;
        return 1;
    }
}
signed main(){
    cin.tie(0)->sync_with_stdio(0);
    cin>>n;
    for(int i=1;i<=n;++i){
        int k;cin>>k;
        for(int j=0;j<k;++j){
            int x;cin>>x,A[i].emplace_back(x);
        }
        sort(A[i].begin(),A[i].end());
        if(A[i].size()<A[rt].size())rt=i;
    }
    for(auto i:A[rt])if(solve(rt,i)){
        for(int j=1;j<=n;++j)cout<<ans[j]<<" \n"[j==n];
        return 0;
    }
    cout<<"-1\n";
    return 0;
}
/*
*/

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 15748kb

input:

3
2 1 4
2 4 3
2 3 1

output:

1 3 3

result:

ok Participant's answer is valid

Test #2:

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

input:

4
1 2
1 3
1 5
1 2

output:

2 3 5 2

result:

ok Participant's answer is valid

Test #3:

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

input:

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

output:

3 3 1

result:

ok Participant's answer is valid

Test #4:

score: 0
Accepted
time: 3ms
memory: 15744kb

input:

10
10 15 33 96 77 35 59 67 86 48 14
10 77 62 46 78 54 43 81 84 41 94
10 85 13 96 66 51 76 97 69 17 41
10 80 36 16 14 48 56 95 4 2 89
10 22 59 63 41 55 39 64 25 24 47
10 57 12 100 47 22 26 77 28 74 24
10 60 38 32 13 73 57 66 20 29 51
10 95 52 87 86 40 100 74 11 57 19
10 41 85 81 1 80 28 82 11 61 20
1...

output:

14 41 41 2 22 22 13 11 11 17

result:

ok Participant's answer is valid

Test #5:

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

input:

10
10 256 235 455 68 912 951 92 72 45 506
10 788 459 858 234 200 205 592 952 981 433
10 983 527 93 481 920 192 540 131 435 825
10 705 122 204 992 882 386 302 251 167 447
10 91 571 199 84 631 3 612 212 751 973
10 294 307 174 414 532 75 843 967 928 218
10 150 987 360 284 503 680 902 652 826 37
10 610 ...

output:

45 200 93 122 3 75 37 37 2 91

result:

ok Participant's answer is valid

Test #6:

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

input:

100
100 308 381 309 879 394 248 348 872 55 891 779 901 180 966 657 557 918 812 3 7 849 927 543 424 994 802 642 549 155 2 929 947 908 809 319 93 865 263 647 460 37 488 689 83 737 493 924 662 980 380 571 499 956 186 893 548 142 434 336 703 610 961 22 616 759 860 221 342 537 189 837 889 986 370 291 97 ...

output:

3 3 6 1 38 25 6 14 10 2 7 18 30 51 2 3 3 1 10 3 8 16 3 3 15 15 4 4 18 9 35 7 1 5 19 2 2 1 3 10 3 20 24 14 16 3 1 33 1 12 14 16 16 5 4 9 2 8 1 9 19 6 25 20 23 3 41 4 11 13 2 5 16 32 1 10 1 6 7 1 1 5 10 31 3 1 2 2 4 7 16 12 12 1 9 4 3 16 2 3

result:

ok Participant's answer is valid

Test #7:

score: 0
Accepted
time: 43ms
memory: 18200kb

input:

5000
100 671148784 781153534 848639850 244318879 920427959 976787159 662986707 17638884 256078787 940932034 15387769 4277164 669457577 981760450 528396899 953853486 789460571 623739311 666137175 571886662 586564182 65402266 983514575 348179501 926943880 621280777 210157624 589857621 209996932 126799...

output:

1225346 10453619 9323826 1882543 2790906 30619840 3756917 11299864 172834 339945 14145194 4146731 4450967 6603201 30809951 7738254 213922 1908854 10817789 11203829 3442576 9184240 5083545 11234721 9911110 7922349 3063246 16230664 10078691 6609086 1831881 11237487 5321674 16494454 9139632 2593716 202...

result:

ok Participant's answer is valid

Test #8:

score: 0
Accepted
time: 81ms
memory: 60320kb

input:

500000
1 742952893
1 894098557
1 316681304
1 169399596
1 407815175
1 591546816
1 629526487
1 405767078
1 583764255
1 375211436
1 905656564
1 50699406
1 656554721
1 254265551
1 796682967
1 368442317
1 555053666
1 255102479
1 742200093
1 772658913
1 555947624
1 719859491
1 832057943
1 137598300
1 5036...

output:

742952893 894098557 316681304 169399596 407815175 591546816 629526487 405767078 583764255 375211436 905656564 50699406 656554721 254265551 796682967 368442317 555053666 255102479 742200093 772658913 555947624 719859491 832057943 137598300 503661037 42304789 376922249 543143268 889959072 163878086 32...

result:

ok Participant's answer is valid

Test #9:

score: 0
Accepted
time: 59ms
memory: 17508kb

input:

2
250000 442152138 501649759 936373770 29058552 527756596 412071790 172023241 444628322 825636620 433787178 596079227 15316744 523579838 685821859 82734705 149524370 546691322 852742895 446063311 870255039 969869509 749178661 272171528 494909074 965998585 24212670 675848630 317500039 297668742 38577...

output:

8915 14483

result:

ok Participant's answer is valid

Test #10:

score: 0
Accepted
time: 7ms
memory: 18616kb

input:

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

output:

4 4 4 4 4 4 1 1 3 3 3 3 3 4 3 3 1 1 1 1 1 4 4 4 4 4 4 1 2 4 1 3 1 1 1 1 2 1 2 2 2 2 2 5 5 1 2 2 2 2 2 2 4 3 2 2 3 6 3 4 4 2 1 1 1 4 4 4 3 3 3 3 1 2 2 2 1 2 2 2 2 2 5 1 2 1 1 5 5 5 1 4 3 3 3 1 1 5 5 1 3 3 2 2 2 1 1 2 5 5 5 5 2 1 3 3 1 2 2 1 7 7 7 7 7 7 7 7 1 1 2 2 1 4 2 2 1 1 1 4 4 2 2 1 3 4 1 2 2 3 ...

result:

ok Participant's answer is valid

Test #11:

score: 0
Accepted
time: 36ms
memory: 19140kb

input:

707
707 462 205 220 449 157 281 404 661 109 258 228 412 425 156 121 37 66 352 324 159 514 144 18 2 688 525 606 158 150 175 225 100 653 191 495 236 388 544 254 342 203 545 667 127 605 224 644 489 613 446 499 457 547 276 640 50 570 672 556 647 515 524 410 40 302 52 4 255 261 137 365 656 380 443 206 97...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Participant's answer is valid

Test #12:

score: 0
Accepted
time: 37ms
memory: 17940kb

input:

707
707 163 98 342 791 845 946 531 229 861 241 267 993 452 816 101 868 902 966 157 496 479 987 393 433 839 365 363 580 297 572 569 571 385 543 508 305 893 780 644 498 699 516 459 829 944 191 353 869 695 938 245 461 898 206 228 806 53 369 640 624 675 789 153 841 217 985 949 899 93 735 470 118 55 372 ...

output:

2 2 3 4 1 1 1 1 1 2 1 1 1 2 2 2 2 1 2 1 2 2 1 1 1 1 1 1 3 3 3 3 3 3 3 1 3 4 4 1 1 3 1 1 3 1 1 1 1 2 2 2 2 1 1 1 2 1 1 1 1 4 3 3 1 1 2 2 1 1 1 1 1 2 2 1 1 2 6 6 6 6 1 2 2 3 2 3 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 1 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 3 3 3 3 2 2 2 2 2 2 2 1 ...

result:

ok Participant's answer is valid

Test #13:

score: 0
Accepted
time: 38ms
memory: 19212kb

input:

707
707 1798 3924 70 9845 3209 2096 9395 3876 1014 7381 9664 3578 6072 2489 6530 95 8252 9318 7775 1190 4336 813 6569 9328 2918 2848 9364 7307 4593 6881 548 5296 2770 8687 3154 8897 7031 8872 7017 6435 1043 9284 8725 4567 5671 5898 8200 7445 6043 7238 8223 9838 8549 8727 4296 5345 7423 1405 7333 212...

output:

2 1 38 6 19 15 5 1 24 1 11 11 11 3 1 16 3 27 11 7 9 27 8 1 6 9 27 33 20 17 3 7 2 2 4 2 17 27 11 13 8 37 30 12 16 74 2 11 5 5 17 24 7 10 18 8 15 15 7 33 4 5 16 19 40 51 4 29 3 2 59 5 23 3 1 13 17 2 15 18 2 12 3 23 2 25 19 2 1 3 9 3 45 4 25 1 43 6 14 47 12 9 19 8 3 23 23 22 6 79 79 6 21 13 33 60 8 8 4...

result:

ok Participant's answer is valid

Test #14:

score: 0
Accepted
time: 40ms
memory: 18480kb

input:

707
707 98690 29052 2358 64566 70039 27002 3809 89772 26977 74842 23560 92465 33178 64062 63948 2143 26052 7753 91631 80297 13511 24672 83461 62073 98881 71717 82703 89314 67249 70499 63149 7599 75522 52486 49936 60909 85608 68608 12003 29194 98603 51942 48583 41371 8962 76486 67693 40180 15006 3033...

output:

106 186 13 276 147 104 197 55 159 11 136 21 116 147 47 120 53 52 193 279 119 85 52 70 217 288 68 9 720 53 133 32 3 11 24 42 34 114 37 69 55 134 76 11 38 236 215 334 32 249 50 5 396 9 75 57 49 276 190 35 32 4 347 37 15 30 3 24 44 21 73 43 28 149 22 99 44 116 167 33 368 2 36 90 280 7 185 377 16 89 169...

result:

ok Participant's answer is valid

Test #15:

score: 0
Accepted
time: 41ms
memory: 19132kb

input:

707
707 11461 397159 620958 546937 953118 199294 153391 480317 214757 956108 453600 243726 596665 319159 119867 845302 138959 198474 429577 66563 58046 658604 957868 390893 672598 288815 723232 106036 471512 120002 563976 204379 998096 341008 796709 932262 94593 218802 353763 464922 741092 482062 94...

output:

1538 2139 947 54 2388 1592 2908 2596 4826 2105 261 618 666 1612 497 723 524 3270 2168 59 1032 1936 3152 4 105 896 3343 1826 213 1899 1427 1339 760 859 526 918 1483 1391 306 947 1632 411 1067 1680 2991 10 1022 1305 427 511 756 724 1940 225 1675 513 1329 946 1281 3295 216 97 2688 1033 703 852 1241 167...

result:

ok Participant's answer is valid

Test #16:

score: 0
Accepted
time: 47ms
memory: 18800kb

input:

707
707 8787373 2939892 2814330 3793835 9041649 7890058 2316606 4888112 399854 7588737 315478 1208686 8498131 7387031 1841819 5657960 985402 2759352 4277972 5678249 2031315 5957526 5521420 5117914 3174542 3898388 7164359 1181584 2824332 1305553 6348053 4486512 2901257 2033262 2452316 6722246 9016879...

output:

16572 7447 5084 950 87780 2429 2964 25977 38761 5693 49399 20905 16316 4803 10931 10585 3481 4181 5364 4937 5145 9023 37250 2753 19294 45381 11595 7971 6874 6069 49310 7630 22772 19280 2636 3584 238 12497 27044 4255 1520 12031 5424 14957 5484 616 18927 34588 11248 12941 17135 71 897 12310 3820 3091 ...

result:

ok Participant's answer is valid

Test #17:

score: 0
Accepted
time: 41ms
memory: 19376kb

input:

707
707 74860507 92404408 88444871 89336338 62958639 2697374 51572347 26638634 60134711 15478421 69674886 42473594 70188846 38833440 15272985 13100083 24628865 28752521 50748805 73022384 93951643 63475269 63276075 92985778 72538058 87885487 13720721 82870793 1596684 960872 43508563 39089430 26584737...

output:

101058 37217 166558 19642 76369 15836 8957 30115 77014 100348 126082 288452 211617 69930 119241 147472 443969 257062 10876 193406 39378 108901 106154 482967 111751 511149 92608 62133 505184 226032 402357 25869 514011 65471 41006 20966 99132 96020 226596 190801 5923 65676 26843 155617 78568 155893 43...

result:

ok Participant's answer is valid

Test #18:

score: 0
Accepted
time: 43ms
memory: 18564kb

input:

707
707 232598134 255883263 597925754 281097223 94049207 691540849 368731913 888958468 761072365 677700359 591551553 260071015 528382187 703133620 131145700 273308737 261511765 155305002 597121777 35339839 597381555 527552708 714853632 628241653 262491307 386231898 496212713 732067926 653679733 6726...

output:

1613312 4385195 647728 535556 134886 344328 49896 5226085 2738553 195051 1320407 3620007 1474503 379048 102787 1375466 972020 1849415 1049576 598028 959693 1117776 392138 569167 1411739 1973882 1140639 35903 220140 770325 3551833 840504 113760 2756338 488924 1203768 3851964 4984653 2780283 379808 58...

result:

ok Participant's answer is valid

Test #19:

score: 0
Accepted
time: 14ms
memory: 20320kb

input:

50000
2 859941562 236957699
2 236957699 859941562
2 859941562 236957699
2 236957699 859941562
2 236957699 859941562
2 236957699 859941562
2 236957699 859941562
2 859941562 236957699
2 859941562 236957699
2 859941562 236957699
2 859941562 236957699
2 859941562 236957699
2 236957699 859941562
2 236957...

output:

859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 859941562 ...

result:

ok Participant's answer is valid

Test #20:

score: 0
Accepted
time: 48ms
memory: 26852kb

input:

100000
8 438108433 122589020 400446743 40813597 204531740 656610695 833008742 59414125
8 122589020 40813597 204531740 400446743 59414125 833008742 438108433 656610695
8 400446743 833008742 59414125 438108433 656610695 204531740 122589020 40813597
8 438108433 400446743 59414125 122589020 40813597 204...

output:

40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 40813597 408...

result:

ok Participant's answer is valid

Test #21:

score: 0
Accepted
time: 38ms
memory: 25780kb

input:

100000
5 985880378 227033521 383620195 925885620 981347393
5 925885620 985880378 383620195 227033521 981347393
5 227033521 981347393 985880378 383620195 925885620
5 925885620 227033521 383620195 981347393 985880378
5 227033521 383620195 925885620 985880378 981347393
5 985880378 227033521 925885620 3...

output:

227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 227033521 ...

result:

ok Participant's answer is valid

Test #22:

score: 0
Accepted
time: 46ms
memory: 26096kb

input:

100000
6 363916896 80958568 590335561 537351142 542226456 363958432
6 363958432 542226456 363916896 537351142 590335561 80958568
6 80958568 590335561 363916896 363958432 542226456 537351142
6 363958432 542226456 363916896 590335561 80958568 537351142
6 542226456 363916896 590335561 80958568 53735114...

output:

80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 80958568 809...

result:

ok Participant's answer is valid

Test #23:

score: 0
Accepted
time: 38ms
memory: 19688kb

input:

10000
46 835736553 820968580 342549323 592363200 197479933 406863162 765958773 624448434 228507411 254634170 67842647 295862717 443551637 41052382 441201741 348082097 703777938 557641290 186691955 260671871 190287462 182179478 448089648 337578271 475439655 850719062 376264871 590845839 328088637 621...

output:

41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 41052382 410...

result:

ok Participant's answer is valid

Test #24:

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

input:

10
9 38998401 266085559 471510400 244678415 904651590 293487744 649258082 138613792 805513144
9 649258082 16228409 904651590 471510400 805513144 293487744 266085559 244678415 138613792
9 244678415 38998401 904651590 266085559 649258082 805513144 293487744 471510400 16228409
9 649258082 805513144 162...

output:

38998401 16228409 16228409 16228409 16228409 16228409 16228409 16228409 16228409 16228409

result:

ok Participant's answer is valid

Test #25:

score: 0
Accepted
time: 2ms
memory: 16276kb

input:

100
99 268703262 411946770 834174801 647621187 496191785 111775901 551653576 596617620 883161948 742881952 317467882 516835198 530430234 639441097 488191257 380020584 725171861 826740405 924703210 499798744 515132461 98553996 457415756 608342442 404355492 27224739 961333461 211059424 696025135 24224...

output:

27224739 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 143892 1438...

result:

ok Participant's answer is valid

Test #26:

score: 0
Accepted
time: 19ms
memory: 17608kb

input:

500
499 744165543 112031145 264882683 125712545 500749325 179234170 202446051 587009730 89104678 719298454 960855463 482734169 144682661 191391677 187926939 263232043 954730334 738691952 307000522 381670640 468496875 310501686 688486702 187842579 557624077 144438352 432571010 979893558 937584298 924...

output:

3506979 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 200344 20034...

result:

ok Participant's answer is valid

Test #27:

score: 0
Accepted
time: 35ms
memory: 19540kb

input:

707
706 594733135 38205706 567561695 776718825 732413006 376862841 755958783 123511008 373221598 177736204 162800673 294383626 52092871 885996855 594240785 825684628 646148102 939711994 770515711 282452516 969752429 204855562 955659555 95990096 497125565 9127694 162171340 984264830 825287893 3835332...

output:

2511065 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190948 2190...

result:

ok Participant's answer is valid

Test #28:

score: 0
Accepted
time: 60ms
memory: 17820kb

input:

3
166940 840613110 46183646 622779664 699953917 116262949 843633889 788326202 561949402 476348987 30835104 40832507 426485558 596024487 235038525 123277544 353180056 613848328 217795092 635470648 913301634 339611470 616654335 173404958 669894924 497274664 502281848 776292124 667914911 199309602 7506...

output:

4553 3971 3971

result:

ok Participant's answer is valid

Test #29:

score: 0
Accepted
time: 47ms
memory: 18564kb

input:

707
707 211191018 698335970 581911973 927419191 531225492 540395567 526094271 403047623 475189932 98186512 411726923 519785376 29982403 543342999 347779434 658057556 429995571 452981373 402462546 620017803 596773651 622385029 22580125 586329026 268227398 856167618 616367329 239163697 390975279 84989...

output:

3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163346 3163...

result:

ok Participant's answer is valid

Extra Test:

score: 0
Extra Test Passed