QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#687803#9525. Welcome to Join the Online Meeting!nahida_qaqAC ✓182ms36064kbC++231.6kb2024-10-29 21:21:392024-10-29 21:21:40

Judging History

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

  • [2024-10-29 21:21:40]
  • 评测
  • 测评结果:AC
  • 用时:182ms
  • 内存:36064kb
  • [2024-10-29 21:21:39]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define io ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pb push_back
using namespace std;
const int N=1e6+5,mod1=1e9+7,mod2=998244353,inf=1e18;
typedef pair<int,int> pi;
int n,m,k;
map<int,int>mp;
int st[N];
vector<int>res[N];
vector<int>g[N];
int ans=0;
int num=1;
int cnt[N];
void bfs(int root)
{
    queue<int>q;
    q.push(root);
    st[root]=1;
    while(q.size())
    {
        int u=q.front();
        q.pop();
        int w=0;
        for(auto v:g[u])
        {
            if(st[v])continue;
            w++;
            num++;
            st[v]=1;
            res[u].pb(v);
            if(!mp.count(v))q.push(v);
        }
        if(w)++ans,cnt[ans]=u;
    }
}
void solve()
{
    cin>>n>>m>>k;
    for(int i=1;i<=k;i++)
    {
        int x;
        cin>>x;
        mp[x]=1;
    }
    int root=-1;
    for(int i=1;i<=m;i++)
    {
        int x,y;
        cin>>x>>y;
        if(!mp.count(x))root=x;
        if(!mp.count(y))root=y;
        g[x].pb(y);
        g[y].pb(x);
    }
    if(k==n||root==-1)
    {
        cout<<"No"<<'\n';
        return ;
    }
    
    bfs(root);
    if(num!=n)
    {
        cout<<"No"<<'\n';
        return ;
    }
    cout<<"Yes"<<'\n';
    cout<<ans<<'\n';
    for(int i=1;i<=ans;i++)
    {
        cout<<cnt[i]<<' '<<res[cnt[i]].size()<<' ';
        for(auto j:res[cnt[i]])
        {
            cout<<j<<' ';
        }
        cout<<'\n';
    }
}
signed main()
{
    io;
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 5876kb

input:

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

output:

Yes
1
2 3 1 3 4 

result:

ok ok

Test #2:

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

input:

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

output:

No

result:

ok ok

Test #3:

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

input:

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

output:

Yes
1
2 3 3 4 1 

result:

ok ok

Test #4:

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

input:

6 6 0

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

output:

No

result:

ok ok

Test #5:

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

input:

200000 199999 2
142330 49798
49798 116486
116486 64386
64386 192793
192793 61212
61212 138489
138489 83788
83788 89573
89573 8596
8596 156548
156548 41800
41800 14478
14478 27908
27908 82806
82806 9353
9353 160166
160166 92308
92308 36265
36265 126943
126943 190578
190578 191148
191148 177381
177381...

output:

Yes
199998
186051 2 42967 142330 
42967 1 107050 
107050 1 159920 
159920 1 187359 
187359 1 111774 
111774 1 4643 
4643 1 22162 
22162 1 119911 
119911 1 165259 
165259 1 80747 
80747 1 145111 
145111 1 99600 
99600 1 157336 
157336 1 31914 
31914 1 158722 
158722 1 154002 
154002 1 156794 
156794 ...

result:

ok ok

Test #6:

score: 0
Accepted
time: 80ms
memory: 31036kb

input:

199999 199998 1
136702
159826 166341
166341 59559
59559 169672
169672 102084
102084 136269
136269 57057
57057 59116
59116 119963
119963 85663
85663 33942
33942 84604
84604 189395
189395 154906
154906 22175
22175 144902
144902 198523
198523 35993
35993 35690
35690 47504
47504 104458
104458 68253
6825...

output:

Yes
199997
57897 2 67051 136702 
67051 1 46188 
46188 1 7309 
7309 1 13560 
13560 1 129012 
129012 1 194652 
194652 1 16855 
16855 1 2643 
2643 1 11843 
11843 1 121085 
121085 1 196582 
196582 1 193681 
193681 1 25576 
25576 1 37117 
37117 1 24236 
24236 1 22598 
22598 1 20647 
20647 1 22635 
22635 ...

result:

ok ok

Test #7:

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

input:

199998 199997 0

67665 130538
130538 101337
101337 73749
73749 138128
138128 1274
1274 108069
108069 50961
50961 7039
7039 109946
109946 170551
170551 193330
193330 113590
113590 92775
92775 2146
2146 43591
43591 125033
125033 75583
75583 173991
173991 46820
46820 3986
3986 163272
163272 91657
91657...

output:

Yes
199997
108040 1 162420 
162420 1 130135 
130135 1 168898 
168898 1 4125 
4125 1 67434 
67434 1 132013 
132013 1 36554 
36554 1 114001 
114001 1 171315 
171315 1 14656 
14656 1 37474 
37474 1 46087 
46087 1 66480 
66480 1 161076 
161076 1 103822 
103822 1 131635 
131635 1 148656 
148656 1 136590 ...

result:

ok ok

Test #8:

score: 0
Accepted
time: 49ms
memory: 28536kb

input:

199997 199996 1
158877
35837 79489
79489 72932
72932 14238
14238 73007
73007 66909
66909 49015
49015 129581
129581 138449
138449 94774
94774 189625
189625 23578
23578 31043
31043 146625
146625 161587
161587 136966
136966 184859
184859 27587
27587 155616
155616 72392
72392 195320
195320 75551
75551 1...

output:

No

result:

ok ok

Test #9:

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

input:

200000 199999 1
29111
29111 80079
29111 131587
29111 197066
29111 125194
29111 156736
50697 29111
29111 74382
113595 29111
29111 26046
29111 172868
178564 29111
174875 29111
93471 29111
88216 29111
29111 147893
29111 145746
29111 34038
146500 29111
67862 29111
29111 19222
29111 121535
29111 49102
29...

output:

No

result:

ok ok

Test #10:

score: 0
Accepted
time: 50ms
memory: 21888kb

input:

199999 199998 2
52512 104330
130511 66864
139434 66864
92884 66864
66864 185580
184115 66864
137395 66864
66864 43463
118395 66864
111697 66864
66864 133237
66864 112507
66864 140264
66864 10
66864 151082
155779 66864
107988 66864
148839 66864
66864 40909
172685 66864
66864 189374
180054 66864
49 66...

output:

Yes
2
152191 1 66864 
66864 199997 130511 139434 92884 185580 184115 137395 43463 118395 111697 133237 112507 140264 10 151082 155779 107988 148839 40909 172685 189374 180054 49 41830 19259 186287 41932 21357 66485 95229 126195 72801 154651 48615 111519 156500 156919 60203 11260 164641 168543 130264...

result:

ok ok

Test #11:

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

input:

199998 199997 0

77056 67665
130538 77056
77056 101337
73749 77056
77056 138128
1274 77056
77056 108069
50961 77056
77056 7039
77056 109946
77056 170551
193330 77056
113590 77056
77056 92775
2146 77056
43591 77056
77056 125033
75583 77056
173991 77056
46820 77056
77056 3986
77056 163272
91657 77056
...

output:

Yes
2
108040 1 77056 
77056 199996 67665 130538 101337 73749 138128 1274 108069 50961 7039 109946 170551 193330 113590 92775 2146 43591 125033 75583 173991 46820 3986 163272 91657 92212 191670 170218 149297 164182 6856 61891 95065 7257 47282 126716 84031 52189 32847 63118 134126 143246 30142 58215 3...

result:

ok ok

Test #12:

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

input:

1000 499500 999
458 720 932 821 847 788 447 593 430 896 257 238 380 924 968 30 389 306 278 824 83 342 329 513 476 313 714 348 602 105 758 777 663 1000 20 756 546 256 123 340 69 244 772 625 390 557 911 272 496 127 409 436 845 574 958 921 24 17 770 630 851 147 178 976 77 181 230 723 974 345 501 683 24...

output:

Yes
1
987 999 516 5 990 603 581 613 664 339 669 702 571 159 399 397 347 481 43 709 916 191 33 517 178 751 897 868 687 155 993 78 378 865 108 677 382 158 937 496 4 541 398 367 237 825 364 518 679 578 199 566 180 894 275 273 305 805 933 524 30 576 707 437 38 513 762 56 349 785 186 461 15 44 991 366 42...

result:

ok ok

Test #13:

score: 0
Accepted
time: 88ms
memory: 14288kb

input:

1000 499000 765
622 257 281 601 593 967 704 173 609 700 782 592 356 595 431 307 933 886 213 478 8 832 877 606 335 253 420 631 345 179 961 437 238 641 513 997 192 483 152 951 580 331 401 122 155 814 228 633 372 918 346 464 3 992 416 953 650 668 971 899 76 575 880 85 194 541 26 348 93 815 554 64 850 5...

output:

Yes
2
639 997 961 803 851 469 804 346 215 74 837 813 42 767 743 574 683 348 125 270 539 399 23 274 240 644 144 263 926 489 258 641 555 353 856 128 415 357 16 185 67 942 676 5 1000 92 195 316 855 139 288 452 829 21 379 623 731 200 629 815 402 12 306 430 129 735 198 444 49 722 518 9 339 253 537 80 814...

result:

ok ok

Test #14:

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

input:

999 300000 98
544 367 966 146 474 309 291 482 953 116 340 59 765 566 227 176 371 672 170 739 120 931 23 858 153 884 258 842 763 405 104 957 596 978 732 515 497 269 174 551 653 690 755 808 288 574 17 356 500 665 827 172 987 240 154 824 220 430 722 950 534 400 413 908 671 12 427 818 187 335 572 644 52...

output:

Yes
8
267 567 429 770 991 708 489 178 351 123 527 365 168 216 730 218 459 327 573 806 914 254 581 794 524 457 967 741 826 613 972 130 361 61 220 767 173 980 444 475 690 778 736 12 420 650 651 537 299 766 534 705 246 442 343 558 18 850 602 614 769 495 934 968 452 55 481 169 117 248 203 387 383 77 319...

result:

ok ok

Test #15:

score: 0
Accepted
time: 168ms
memory: 15276kb

input:

10000 500000 10000
1905 4872 6021 8458 3220 7251 6356 3194 996 2320 298 7850 3567 2244 4361 7462 8058 9852 3057 6409 2288 9712 8533 5380 7131 970 2261 134 1179 1665 7329 442 8996 8203 7168 5946 7893 8282 9474 2445 1762 4900 101 6631 4588 7670 7716 7010 6113 5654 5308 3451 130 3205 2959 4898 374 6178...

output:

No

result:

ok ok

Test #16:

score: 0
Accepted
time: 164ms
memory: 17612kb

input:

10000 500000 9998
5272 7519 3021 7043 2522 2940 9960 3860 7595 3760 8035 2085 572 234 8292 3636 9619 6749 884 6669 8536 570 9353 2803 160 6085 5838 2812 7764 8722 2431 8854 2183 2032 7731 5404 5516 1574 4864 1431 8527 5506 1012 5713 8665 26 976 6010 4888 5975 6993 3187 7227 8438 6812 5903 1738 6467 ...

output:

No

result:

ok ok

Test #17:

score: 0
Accepted
time: 115ms
memory: 16964kb

input:

10000 500000 1234
7096 8517 9305 874 7758 730 2653 6237 2494 4290 2280 892 9081 2308 6418 3258 1690 103 9850 6778 9724 1914 1561 1361 3776 160 1892 1394 7981 3050 6013 5452 8769 7341 3259 6011 8672 4500 1930 8758 5103 4509 2782 1354 1583 8663 1088 2156 3254 7150 3824 4768 8230 7533 3277 8910 8135 19...

output:

Yes
510
8050 117 2265 2231 3298 1060 6515 5397 4454 9319 631 6397 5779 3040 4275 2888 2019 5265 1436 4923 6440 1427 5534 1110 6067 5969 4855 1638 1453 7215 1061 1512 8840 83 9655 1071 3654 7590 3198 9422 8025 8596 3406 1752 2547 1403 1995 415 1548 1714 3432 9733 6002 8109 8912 4908 6027 7512 4600 84...

result:

ok ok

Test #18:

score: 0
Accepted
time: 58ms
memory: 16968kb

input:

10000 500000 0

6605 3715
1237 3040
3617 2124
4550 1766
8159 4808
7027 9779
7053 1803
3973 6790
8233 2873
7636 6894
6821 9714
8280 8440
261 6160
1279 3627
5816 9131
8167 1332
6763 3029
9605 4045
921 9926
6547 4760
3618 7832
5961 6497
1255 5646
5567 621
5732 2860
88 3501
3866 6046
7188 6203
3337 2873...

output:

Yes
507
6414 91 6980 5609 5724 9932 9392 7912 9035 5059 2025 1536 8260 4926 4692 5020 9227 3792 847 810 3758 5688 6647 1968 1094 5579 8275 2912 8197 5495 9266 5549 5366 7059 339 70 3076 3318 915 5525 617 5461 6802 2943 7442 1947 5959 710 6634 1669 7032 4355 8136 5856 5012 1411 33 399 6360 3597 1123 ...

result:

ok ok

Test #19:

score: 0
Accepted
time: 112ms
memory: 18304kb

input:

20000 499999 321
13495 16729 10971 3389 7920 17768 11943 12054 6426 13331 6453 15959 6842 12610 18437 12930 4597 7386 8506 52 17373 2492 18849 19694 8432 12552 8663 4836 5370 3125 4323 15529 5916 14378 13756 15147 19826 7961 3188 4919 14256 5230 16288 13867 6039 13451 12861 9057 12645 19486 16719 19...

output:

Yes
1785
12714 41 16806 17226 2908 14348 8029 10354 3220 8951 12145 17903 12587 11172 15650 2718 2376 4873 19385 5091 18958 6574 7270 5092 1018 13796 6307 15789 5797 12787 11322 19366 893 5444 12985 4462 941 17326 13526 7461 1308 16507 5958 
16806 56 6751 12406 4561 8692 17212 8966 4297 6176 15669 1...

result:

ok ok

Test #20:

score: 0
Accepted
time: 119ms
memory: 20588kb

input:

20000 499998 456
17380 3548 17148 12088 15694 2886 15042 15060 4903 3288 13810 5360 7487 15472 1934 6496 19753 7795 9485 16913 17980 18738 18003 3795 5186 18128 15284 3276 16833 13161 6707 8941 947 5088 4974 13222 1790 14903 14837 4315 17583 12119 15871 6961 11561 3674 18427 2207 1556 19736 719 2326...

output:

Yes
1810
10230 47 1345 11756 1063 14168 2115 5161 9301 3474 4399 6819 6989 2686 15174 17321 19140 1840 15925 2375 15918 19580 11003 11987 4442 8147 19220 6696 15586 5777 16357 14268 11319 5447 14942 2283 2549 8030 18823 6054 17649 2248 15091 18187 10010 13668 19104 812 8203 
1345 53 12366 12279 8894...

result:

ok ok

Test #21:

score: 0
Accepted
time: 168ms
memory: 25076kb

input:

100000 500000 1235
3510 14575 57589 88714 29299 62839 6733 25039 17686 8112 24858 274 16916 83976 25181 57773 49758 65223 33663 47471 12200 8551 57927 21092 67375 77093 76589 91355 94075 17071 50791 43800 72672 54280 19504 106 10971 87577 40091 88380 81937 27327 24188 78489 92382 43581 8875 22402 41...

output:

No

result:

ok ok

Test #22:

score: 0
Accepted
time: 127ms
memory: 25288kb

input:

100000 500000 9
34008 13155 90342 28233 23089 86546 14071 6854 11360
3498 65486
65603 70184
14269 18649
79366 11163
66926 49216
4445 76420
50121 20493
2808 43301
18218 44910
92999 97448
13760 37138
15100 36649
34074 1879
72027 68411
54611 87760
1896 60316
43650 8286
34285 74403
21309 96104
49344 941...

output:

Yes
28744
64592 13 70213 47953 67777 85009 2288 29247 75348 17063 6797 10562 66406 57720 38859 
70213 11 20744 39882 21683 71459 31121 77399 50982 78796 99792 28862 4131 
47953 4 82431 53509 93324 10187 
67777 12 8646 41044 20622 19451 29890 50055 49296 79382 17004 63696 60293 15963 
85009 7 8088 32...

result:

ok ok

Test #23:

score: 0
Accepted
time: 116ms
memory: 25272kb

input:

100000 500000 1
75076
9583 32552
72566 77581
74823 25463
58197 78380
62002 94563
99622 60434
39479 68180
1722 38894
43269 85989
33777 78513
5464 79304
57968 37134
88958 60066
61043 23394
50002 93317
59516 46962
55978 3705
2504 341
70466 21789
42193 45686
1370 18780
91444 2274
93546 66571
97443 53551...

output:

Yes
28564
30873 15 97053 59571 29659 74315 62665 63366 66450 10671 30944 76804 83616 87480 15882 22803 20630 
97053 8 97771 18552 4564 18323 41146 48459 28039 72078 
59571 13 67650 10675 67419 21286 23420 84451 14488 82992 42728 95798 72596 12754 50101 
29659 12 62566 50334 44079 58311 34488 95465 8...

result:

ok ok

Test #24:

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

input:

100000 500000 0

39862 49976
22596 40406
37185 98022
80733 93561
81387 94842
25064 61254
42694 16911
22623 87861
89266 37654
59510 12230
43457 79569
73883 19406
63275 92754
22177 11799
5763 44974
1570 83476
79123 73330
45165 77314
63415 32676
70388 8398
22032 77785
63620 61574
23429 41486
30923 1236...

output:

Yes
28775
83330 7 25898 42347 55745 31129 30365 3750 2326 
25898 15 36009 42505 56762 23569 60688 40040 29297 56269 50561 41171 90252 85169 5476 82943 21486 
42347 10 80623 32586 17776 95927 3420 72094 37106 80286 97004 6936 
55745 9 58977 15005 74642 89130 98799 95557 61915 70842 43621 
31129 10 71...

result:

ok ok

Test #25:

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

input:

199999 200000 10
162044 184301 102211 174303 129412 46215 153004 13679 113247 194319
100393 176945
52810 193834
159859 44467
119931 61763
196292 30856
21297 175055
20174 1882
11250 184866
74000 1054
74272 134956
41299 186242
162575 63218
119189 12678
29884 5001
148164 16567
24612 169902
77735 135002...

output:

No

result:

ok ok

Test #26:

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

input:

200000 199999 0

142790 145621
180161 104270
112230 88214
154000 63048
188285 141046
185739 50230
142683 197737
141276 49672
41219 95859
175530 171250
171226 174408
151297 88982
28928 71368
199034 63185
116370 106685
192890 167797
132366 79091
78160 89965
177169 151554
172583 127365
9032 60583
78786...

output:

No

result:

ok ok

Test #27:

score: 0
Accepted
time: 182ms
memory: 35788kb

input:

200000 500000 245
193722 185527 109052 75916 93935 24076 79627 20964 180786 120016 132778 186582 144529 16308 58727 114586 130490 34200 113593 7386 151039 39324 175706 195617 169880 139107 160903 183556 167931 124336 92216 181943 41472 98648 191217 191760 19769 86540 4125 65866 133876 106754 96372 1...

output:

No

result:

ok ok

Test #28:

score: 0
Accepted
time: 151ms
memory: 33232kb

input:

200000 500000 14
142703 65403 129451 151977 165363 20230 132897 87039 9024 158327 31353 194121 16577 146056
139648 187616
8050 35431
127655 35285
195736 80740
3874 174224
168938 136840
97592 176911
12210 58008
85816 66096
61709 179153
69540 1567
86595 14951
182066 29930
183615 37773
166329 61767
167...

output:

No

result:

ok ok

Test #29:

score: 0
Accepted
time: 159ms
memory: 36064kb

input:

200000 500000 1
5880
85775 146428
142622 151159
88421 138441
169300 66421
147351 32187
62008 74476
82579 109015
176101 15964
50525 172923
142682 150232
178015 197099
29910 154380
124900 65984
825 137825
194984 139256
31396 65802
141485 14608
126721 85235
193397 167129
98424 54611
63857 8244
68507 68...

output:

Yes
87337
143170 6 90953 123672 59719 117409 188591 164977 
90953 4 166255 165230 98466 199379 
123672 8 121939 164523 81063 65709 100772 92683 85767 138615 
59719 3 174288 54342 110092 
117409 6 153294 101272 92749 59432 181257 28771 
188591 7 161333 65008 97909 161420 101107 158 152205 
164977 2 1...

result:

ok ok

Test #30:

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

input:

199999 199998 73589
144387 49530 75323 115971 116495 141238 92902 186288 75011 21274 196 62128 161581 112516 16226 166382 73692 120539 170346 127146 153896 57832 23870 56030 110186 132465 101619 681 13908 5901 194116 151154 160650 78720 87497 131676 94642 65227 153151 67720 61825 132140 114363 76085...

output:

Yes
126410
82275 4 82799 82798 82797 81723 
82798 1 83319 
82797 3 83317 83316 83318 
81723 2 81156 82274 
83319 1 83831 
81156 1 80602 
82274 3 82795 82796 82794 
80602 1 80064 
82795 1 83314 
82796 1 83315 
80064 3 79534 80603 80601 
83314 1 83830 
79534 1 78996 
80603 1 81157 
78996 2 79533 78423...

result:

ok ok

Test #31:

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

input:

2 1 1
1
1 2

output:

Yes
1
2 1 1 

result:

ok ok

Test #32:

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

input:

2 1 0

1 2

output:

Yes
1
2 1 1 

result:

ok ok

Extra Test:

score: 0
Extra Test Passed