QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#685086#9284. Christmas Children CircleKavenSkyAC ✓295ms126256kbC++231.1kb2024-10-28 17:32:402024-10-28 17:32:41

Judging History

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

  • [2024-10-28 17:32:41]
  • 评测
  • 测评结果:AC
  • 用时:295ms
  • 内存:126256kb
  • [2024-10-28 17:32:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define INF 1e12
const int N=1e6+5;
typedef pair<int,int> P;
typedef long long ll;
typedef pair<ll,ll>Pll;
typedef __int128 i128;
const ll mod=1e9+7;
typedef long double db;
const db eps=1e-10;
mt19937_64 rnd(time(0));
void solve(){
    int n;
    cin >> n;
    map<int,map<int,int>>mp;
    vector<int>a[n];
    for(int i=0;i<n;i++){
        int k;
        cin >> k;
        for(int j=0;j<k;j++){
            int x;
            cin >> x;
            a[i].push_back(x);
            mp[i][x]++;
        }
    }
    auto las=[&](int i){
        return (i-1+n)%n;
    };
    auto nxt=[&](int i){
        return (i+1)%n;
    };
    vector<int>ans(n);
    ans[0]=a[0][0];
    for(int i=1;i<n;i++){
        if(mp[i][ans[las(i)]]) ans[i]=ans[las(i)];
        else ans[i]=a[i][0];
    }
    for(int i=0;i<n;i++){
        if(mp[i][ans[las(i)]]) ans[i]=ans[las(i)];
        else break;
    }
    for(auto x:ans) cout << x << " ";
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    //cin >> t;
    while(t--)
    solve();
}

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

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3676kb

input:

3
2 1 4
2 4 3
2 3 1

output:

1 4 3 

result:

ok Participant's answer is valid

Test #2:

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

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: 3676kb

input:

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

output:

5 3 2 

result:

ok Participant's answer is valid

Test #4:

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

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:

15 77 85 80 22 22 60 95 41 76 

result:

ok Participant's answer is valid

Test #5:

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

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:

256 788 983 705 91 294 150 610 228 255 

result:

ok Participant's answer is valid

Test #6:

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

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:

308 895 569 218 395 528 42 246 428 264 728 750 620 314 778 893 528 365 107 402 741 863 911 963 54 583 891 767 98 98 427 347 426 5 326 327 662 383 410 56 768 768 141 262 625 873 761 423 362 513 318 194 662 237 727 975 800 610 966 960 107 400 351 360 452 452 995 610 624 294 631 631 552 663 347 769 816...

result:

ok Participant's answer is valid

Test #7:

score: 0
Accepted
time: 110ms
memory: 30524kb

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:

671148784 903582173 670826307 724646618 807880344 467666937 117551668 486913829 125784033 241389204 885387986 754156990 807980213 65426156 653348386 239582254 117374448 764079899 760178337 269708094 622745636 624207024 908425590 650120244 607637136 546351030 755219398 690971239 952322691 119773714 4...

result:

ok Participant's answer is valid

Test #8:

score: 0
Accepted
time: 295ms
memory: 126256kb

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: 219ms
memory: 28808kb

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:

442152138 875325132 

result:

ok Participant's answer is valid

Test #10:

score: 0
Accepted
time: 18ms
memory: 10584kb

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:

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

result:

ok Participant's answer is valid

Test #11:

score: 0
Accepted
time: 79ms
memory: 30072kb

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:

462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 462 ...

result:

ok Participant's answer is valid

Test #12:

score: 0
Accepted
time: 92ms
memory: 29984kb

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:

281 281 281 281 810 610 279 687 792 792 792 601 601 601 601 601 601 427 427 427 427 427 427 427 427 427 427 427 427 427 427 427 427 972 822 109 109 109 109 861 861 953 953 953 953 953 953 953 953 953 300 300 300 300 374 374 374 374 374 374 374 374 374 374 444 52 784 784 784 784 210 210 200 200 265 2...

result:

ok Participant's answer is valid

Test #13:

score: 0
Accepted
time: 92ms
memory: 30304kb

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:

1503 1503 2892 3420 6800 6800 7646 3574 6414 5191 4257 1648 8487 5621 6438 1042 2185 5342 187 9403 5167 5167 9775 6259 7233 9811 3844 512 7211 8148 80 1774 5143 3925 6570 5423 5682 9402 8781 258 1602 7219 923 698 9744 2593 7226 608 7823 4926 6543 9789 9789 3525 5827 4171 6349 9554 5581 3558 7520 740...

result:

ok Participant's answer is valid

Test #14:

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

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:

98690 22682 35132 50781 77816 88246 93085 91419 37505 90021 6801 24582 22948 14752 34842 63117 50623 14334 78746 99256 95351 19203 61250 5434 22132 21929 88339 37486 9035 79382 94861 95738 26137 37186 4797 59 55537 75515 71750 20420 2549 67518 41065 45557 45557 69171 89720 83245 91717 43089 76073 54...

result:

ok Participant's answer is valid

Test #15:

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

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:

11461 836012 900812 199961 408956 332188 376408 405902 892477 934770 353680 570430 843630 692910 36766 400881 668372 126171 641888 980998 784379 895895 280130 990451 974829 447413 602495 411866 393966 220997 233776 643749 638294 761485 450636 546386 529470 746077 570523 82381 708745 497606 699598 86...

result:

ok Participant's answer is valid

Test #16:

score: 0
Accepted
time: 107ms
memory: 30072kb

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:

8787373 3982175 8798165 2958378 7761502 2022115 2325280 4005163 2377763 3742974 1741012 9455881 8862971 959274 5625528 7260241 7993752 9938881 6687497 1608377 9507798 9408624 9868981 1976714 3295139 2250070 7941570 6445829 5229672 6232059 9927740 2283751 3153846 1716606 173159 4147843 6991268 746838...

result:

ok Participant's answer is valid

Test #17:

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

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:

74860507 39803802 67402863 9713560 9884519 2113236 51153482 15322447 42831391 26291035 27787984 7612580 76352248 52054853 15279913 3042738 96075775 7973050 92139247 13321949 46280011 85212512 86543145 64905439 7653727 17104229 93462820 38516096 60098857 71759899 12257033 24742296 40240465 50232557 2...

result:

ok Participant's answer is valid

Test #18:

score: 0
Accepted
time: 94ms
memory: 30276kb

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:

232598134 611734563 540264609 566709251 951138450 967388731 257734749 262549403 952246086 88270983 375809408 254507986 512633042 944812212 635766308 297554592 653405636 359449294 247961158 380846128 67173636 395267465 977454361 243222503 360501041 402606817 629680536 997678457 465715412 198648763 81...

result:

ok Participant's answer is valid

Test #19:

score: 0
Accepted
time: 31ms
memory: 15784kb

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: 136ms
memory: 43040kb

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:

204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 204531740 ...

result:

ok Participant's answer is valid

Test #21:

score: 0
Accepted
time: 131ms
memory: 42408kb

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:

985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 985880378 ...

result:

ok Participant's answer is valid

Test #22:

score: 0
Accepted
time: 146ms
memory: 42136kb

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:

590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 590335561 ...

result:

ok Participant's answer is valid

Test #23:

score: 0
Accepted
time: 109ms
memory: 30928kb

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:

454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 454405766 ...

result:

ok Participant's answer is valid

Test #24:

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

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:

244678415 244678415 244678415 649258082 649258082 649258082 649258082 244678415 244678415 244678415 

result:

ok Participant's answer is valid

Test #25:

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

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:

153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 153927087 268703262 268703262 268703262 268703262 268703262 268703262 268703262 268703262 268703262 331889978 331889978 331889978 331889978 331889978 331889978 893184316 ...

result:

ok Participant's answer is valid

Test #26:

score: 0
Accepted
time: 53ms
memory: 16448kb

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:

661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 661590530 ...

result:

ok Participant's answer is valid

Test #27:

score: 0
Accepted
time: 97ms
memory: 30008kb

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:

123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 123511008 ...

result:

ok Participant's answer is valid

Test #28:

score: 0
Accepted
time: 178ms
memory: 28752kb

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:

840613110 840613110 944067673 

result:

ok Participant's answer is valid

Test #29:

score: 0
Accepted
time: 98ms
memory: 30000kb

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:

57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 57081345 570...

result:

ok Participant's answer is valid

Extra Test:

score: 0
Extra Test Passed