QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#752174#5307. Subgraph Isomorphismeinekleine18WA 72ms3556kbC++20896b2024-11-15 22:32:222024-11-15 22:32:22

Judging History

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

  • [2024-11-15 22:32:22]
  • 评测
  • 测评结果:WA
  • 用时:72ms
  • 内存:3556kb
  • [2024-11-15 22:32:22]
  • 提交

answer

#include<bits/stdc++.h>
#include <vector>

#define int long long
void slove(){
    int n,m;
    std::cin>>n>>m;
    std::vector g(n,std::set<int>());
    for(int i=0;i<m;++i){
        int a,b;
        std::cin>>a>>b;
        --a,--b;
        g[a].insert(b);
        g[b].insert(a);
    }
    m=0;
    for(int i=0;i<n;++i){
        m+=g[i].size();
    }
    m/=2;
    int f=0;
    if(m==n-1){
        f=1;
    }else if(m==n){
        f=1;
        for(int i=0;i<n;++i){
            if((int)g[i].size()!=2){
                f=0;
            }
        }
    }
    std::cout<<(f?"Yes\n":"No\n");
}
signed main(){
#ifdef LOCAL
    std::freopen("in.txt","r",stdin);
    std::freopen("out.txt","w",stdout);
#endif
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int _=1;
    std::cin>>_;
    for(int i=0;i<_;++i){
        slove();
    }
}

詳細信息

Test #1:

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

input:

4
7 6
1 2
2 3
3 4
4 5
5 6
3 7
3 3
1 2
2 3
3 1
5 5
1 2
2 3
3 4
4 1
1 5
1 0

output:

Yes
Yes
No
Yes

result:

ok 4 token(s): yes count is 3, no count is 1

Test #2:

score: -100
Wrong Answer
time: 72ms
memory: 3504kb

input:

33192
2 1
1 2
3 2
1 3
2 3
3 3
1 2
1 3
2 3
4 3
1 4
2 4
3 4
4 3
1 3
1 4
2 4
4 4
1 3
1 4
2 4
3 4
4 4
1 3
1 4
2 3
2 4
4 5
1 3
1 4
2 3
2 4
3 4
4 6
1 2
1 3
1 4
2 3
2 4
3 4
5 4
1 5
2 5
3 5
4 5
5 4
1 4
1 5
2 5
3 5
5 5
1 4
1 5
2 5
3 5
4 5
5 5
1 4
1 5
2 4
3 5
4 5
5 5
1 4
1 5
2 4
2 5
3 5
5 6
1 4
1 5
2 4
2 5
3 ...

output:

Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

wrong answer expected YES, found NO [39th token]