QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#768949#9525. Welcome to Join the Online Meeting!wk6_AC ✓148ms37572kbC++171.4kb2024-11-21 15:24:512024-11-21 15:24:52

Judging History

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

  • [2024-11-21 15:24:52]
  • 评测
  • 测评结果:AC
  • 用时:148ms
  • 内存:37572kb
  • [2024-11-21 15:24:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn=200005;
int read(){
    int ret=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
    while( isdigit(ch)){ret=(ret<<3)+(ret<<1)+(ch&15);ch=getchar();}
    return ret*f;
}
int n,m,k,s,tot; 
vector<int> G[maxn],son[maxn];
int dfn[maxn],id[maxn];
bool dwn[maxn],vis[maxn];
void DFS(int now){
    vis[now]=1;
    if(dwn[now]) return ;
    dfn[now]=++tot;
    id[tot]=now;
    for(auto s:G[now]){
        if(vis[s]) continue;
        DFS(s);
        son[now].push_back(s);
    }
}
int main(){
    n=read(),m=read(),k=read();
    for(int i=1;i<=k;++i){
        dwn[read()]=1;
    }
    for(int i=1;i<=m;++i){
        int u=read(),v=read();
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for(int i=1;i<=n;++i){
        if(!dwn[i]){
            s=i;
            break;
        }
    }
    DFS(s);
    for(int i=1;i<=n;++i){
        if(!vis[i]){
            printf("No\n");
            return 0;
        }
    }
    int num=0;
    for(int i=1;i<=tot;++i){
        int now=id[i];
        if(!son[now].size()) num++;
    }
    printf("Yes\n%d\n",tot-num);
    for(int i=1;i<=tot;++i){
        int now=id[i];
        if(!son[now].size()) continue;
        printf("%d ",now);
        printf("%d ",son[now].size());
        for(auto s:son[now]) printf("%d ",s);
        printf("\n");
    }
    return 0;
}

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

詳細信息

Test #1:

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

input:

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

output:

Yes
2
1 1 2 
2 2 3 4 

result:

ok ok

Test #2:

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

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: 3ms
memory: 13180kb

input:

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

output:

Yes
1
1 3 3 4 2 

result:

ok ok

Test #4:

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

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: 78ms
memory: 35352kb

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
1 2 95113 178679 
95113 1 27292 
27292 1 93394 
93394 1 30051 
30051 1 174891 
174891 1 165580 
165580 1 94294 
94294 1 123410 
123410 1 55130 
55130 1 154872 
154872 1 166138 
166138 1 30681 
30681 1 51031 
51031 1 89161 
89161 1 187764 
187764 1 14291 
14291 1 66035 
66035 1 83781 
8378...

result:

ok ok

Test #6:

score: 0
Accepted
time: 102ms
memory: 34696kb

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
1 2 172082 191801 
172082 1 188910 
188910 1 131169 
131169 1 48799 
48799 1 20862 
20862 1 189938 
189938 1 46325 
46325 1 48691 
48691 1 45299 
45299 1 166683 
166683 1 155350 
155350 1 88290 
88290 1 140962 
140962 1 106716 
106716 1 180949 
180949 1 116565 
116565 1 41562 
41562 1 528...

result:

ok ok

Test #7:

score: 0
Accepted
time: 90ms
memory: 35200kb

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
199996
1 2 5661 102870 
5661 1 114962 
114962 1 36222 
36222 1 92959 
92959 1 66511 
66511 1 81220 
81220 1 182229 
182229 1 7906 
7906 1 81750 
81750 1 75132 
75132 1 188940 
188940 1 144653 
144653 1 76023 
76023 1 120474 
120474 1 155713 
155713 1 152446 
152446 1 26414 
26414 1 110040 
11004...

result:

ok ok

Test #8:

score: 0
Accepted
time: 33ms
memory: 31260kb

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: 21ms
memory: 20404kb

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: 38ms
memory: 22804kb

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
1 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 3648...

result:

ok ok

Test #11:

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

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
1 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 3315 1...

result:

ok ok

Test #12:

score: 0
Accepted
time: 16ms
memory: 18240kb

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: 17ms
memory: 18608kb

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
235
1 8 241 545 810 270 530 700 627 859 
859 6 671 881 253 372 981 492 
492 5 6 856 918 738 7 
7 1 800 
800 5 157 436 246 193 260 
260 1 51 
51 3 891 839 532 
532 3 331 321 494 
494 3 487 263 121 
121 2 404 945 
945 5 104 850 173 305 474 
474 7 733 259 909 529 725 286 499 
499 1 807 
807 1 599 
...

result:

ok ok

Test #14:

score: 0
Accepted
time: 11ms
memory: 18756kb

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
899
1 1 249 
249 1 302 
302 2 839 618 
618 1 919 
919 1 243 
243 2 367 440 
440 1 636 
636 1 70 
70 1 973 
973 1 86 
86 1 887 
887 2 170 127 
127 1 721 
721 1 92 
92 1 619 
619 1 507 
507 1 205 
205 2 824 181 
181 1 418 
418 1 318 
318 1 239 
239 1 981 
981 3 722 845 398 
398 1 351 
351 1 464 
4...

result:

ok ok

Test #15:

score: 0
Accepted
time: 16ms
memory: 19320kb

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: 30ms
memory: 19344kb

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: 30ms
memory: 20424kb

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
8677
1 1 5604 
5604 1 7605 
7605 1 6401 
6401 1 1630 
1630 1 1082 
1082 1 1247 
1247 2 4142 7591 
7591 1 5402 
5402 2 5785 4868 
4868 1 5887 
5887 1 7658 
7658 1 7640 
7640 1 3351 
3351 1 2506 
2506 1 203 
203 1 9837 
9837 1 2262 
2262 1 1841 
1841 1 9504 
9504 1 3844 
3844 1 7797 
7797 1 759 
7...

result:

ok ok

Test #18:

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

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
9899
1 1 9149 
9149 1 4615 
4615 1 8457 
8457 1 3046 
3046 1 6912 
6912 1 7307 
7307 1 147 
147 1 2395 
2395 1 872 
872 1 7728 
7728 1 7628 
7628 1 5402 
5402 1 9774 
9774 1 3163 
3163 1 6135 
6135 1 7620 
7620 1 5208 
5208 1 5193 
5193 1 8763 
8763 1 5530 
5530 1 6827 
6827 1 8616 
8616 1 1857 ...

result:

ok ok

Test #19:

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

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
19301
1 1 6778 
6778 1 16530 
16530 1 16618 
16618 1 15188 
15188 1 77 
77 1 9214 
9214 1 15405 
15405 1 19432 
19432 1 6013 
6013 1 14988 
14988 1 16084 
16084 1 11883 
11883 1 9253 
9253 1 1152 
1152 1 8377 
8377 1 7986 
7986 1 2495 
2495 1 2825 
2825 1 9701 
9701 1 14598 
14598 1 16325 
16325...

result:

ok ok

Test #20:

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

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
19139
1 1 12128 
12128 1 6615 
6615 1 14109 
14109 1 18795 
18795 1 18050 
18050 1 15025 
15025 1 1641 
1641 1 2739 
2739 1 13482 
13482 1 3106 
3106 1 4472 
4472 1 4168 
4168 1 6477 
6477 1 14749 
14749 1 18106 
18106 1 6571 
6571 1 10463 
10463 1 11277 
11277 1 2049 
2049 1 11791 
11791 1 1887...

result:

ok ok

Test #21:

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

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: 99ms
memory: 29652kb

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
90450
1 1 16265 
16265 1 771 
771 1 77662 
77662 1 49505 
49505 1 91008 
91008 1 93469 
93469 1 85461 
85461 1 87629 
87629 1 53658 
53658 1 90605 
90605 1 37269 
37269 1 81093 
81093 1 8433 
8433 1 55437 
55437 1 13805 
13805 1 18085 
18085 1 84078 
84078 1 6995 
6995 1 11149 
11149 1 54573 
54...

result:

ok ok

Test #23:

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

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
90507
1 1 79657 
79657 1 37013 
37013 1 69480 
69480 1 66579 
66579 1 62610 
62610 1 13251 
13251 1 77225 
77225 1 2335 
2335 1 52830 
52830 1 86331 
86331 1 79033 
79033 1 82147 
82147 1 93075 
93075 1 50503 
50503 1 61127 
61127 1 27489 
27489 1 28776 
28776 1 11605 
11605 1 48938 
48938 1 673...

result:

ok ok

Test #24:

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

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
90407
1 1 63233 
63233 1 75278 
75278 1 42712 
42712 1 31241 
31241 1 63265 
63265 1 55719 
55719 1 92483 
92483 1 47086 
47086 1 73387 
73387 1 55491 
55491 1 28596 
28596 1 75631 
75631 1 2174 
2174 1 93896 
93896 1 21833 
21833 1 87825 
87825 1 62030 
62030 1 99990 
99990 1 84317 
84317 1 704...

result:

ok ok

Test #25:

score: 0
Accepted
time: 54ms
memory: 24956kb

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: 50ms
memory: 24068kb

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: 124ms
memory: 37572kb

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: 137ms
memory: 37376kb

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: 148ms
memory: 37380kb

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
164527
1 1 190782 
190782 1 15819 
15819 1 159187 
159187 1 17201 
17201 1 167955 
167955 1 181339 
181339 1 181570 
181570 1 168980 
168980 1 160291 
160291 1 80652 
80652 1 7607 
7607 1 131159 
131159 1 145032 
145032 1 106788 
106788 1 127705 
127705 1 56789 
56789 1 70545 
70545 1 85423 
854...

result:

ok ok

Test #30:

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

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
2 3 3 1 4 
4 1 5 
5 4 8 7 6 9 
8 1 11 
7 1 10 
10 1 13 
9 1 12 
12 1 14 
14 1 15 
15 2 17 16 
17 2 19 18 
19 2 20 21 
21 2 23 22 
23 2 25 26 
25 1 27 
26 2 28 29 
28 2 31 30 
29 1 32 
32 2 33 34 
33 2 35 36 
35 1 38 
38 2 42 43 
42 3 50 51 52 
51 1 68 
52 3 69 70 71 
71 1 87 
87 2 105 104...

result:

ok ok

Test #31:

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

input:

2 1 1
1
1 2

output:

Yes
1
2 1 1 

result:

ok ok

Test #32:

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

input:

2 1 0

1 2

output:

Yes
1
1 1 2 

result:

ok ok

Extra Test:

score: 0
Extra Test Passed