QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#719803#9525. Welcome to Join the Online Meeting!20225954WA 1ms5732kbC++201.2kb2024-11-07 09:03:362024-11-07 09:03:36

Judging History

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

  • [2024-11-07 09:03:36]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5732kb
  • [2024-11-07 09:03:36]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define db(x) cerr<<#x<<(x)<<"\n"
#define db1(x) cerr<<#x<<(x)<<" "
#define ll long long
const int N = 2e5+10;
int n,m,k;
int a[N];
using pii = pair<int,int>;
vector<pii> e;
int fa[N],vis[N],ok[N];
vector<int> ans[N];
int main()
{
    cin>>n>>m>>k;
    for(int i=1;i<=k;i++){
        int x;cin>>x;vis[x] =1;
    }
    for(int i=1;i<=m;i++){
        int x,y;cin>>x>>y;
        e.push_back({x,y});
    }
    for(auto [x,y]:e){
        if(vis[x]&&vis[y])continue;
        if(vis[x])swap(x,y);
        if(ok[y])continue;
        ans[x].push_back(y);
        ok[x]=  ok[y] =1;
    }
    int num =0;
    for(int i=1;i<=n;i++){
        if(ok[i]==0)++num;
    }
    if(num==0){
        cout<<"Yes\n";
        int num1 =0;
        for(int i=1;i<=n;i++){
            if(ans[i].size())++num1;
        }
        cout<<num1<<"\n";
        for(int i=1;i<=n;i++){
            if(ans[i].size()){
                cout<<i<<" "<<ans[i].size()<<" ";
                for(auto x:ans[i]){
                    cout<<x<<" ";
                }
                cout<<"\n";
            }
        }
    }else {
        cout<<"No\n";
    }
    
}

详细

Test #1:

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

input:

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

output:

Yes
2
1 2 2 3 
2 1 4 

result:

ok ok

Test #2:

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

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: 1ms
memory: 5728kb

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: -100
Wrong Answer
time: 1ms
memory: 3604kb

input:

6 6 0

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

output:

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

result:

wrong answer on step #3, member 4 is not invited before inviting others