QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#490222#5745. Graph Isomorphismucup-team1525#WA 8ms3816kbC++20972b2024-07-25 13:05:462024-07-25 13:05:46

Judging History

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

  • [2024-07-25 13:05:46]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:3816kb
  • [2024-07-25 13:05:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m;
const int N=100005;
int d[N];
void solve()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;++i)
        d[i]=0;
    for (int i=1,u,v;i<=m;++i)
    {
        scanf("%d%d",&u,&v);
        ++d[u];
        ++d[v];
    }
    if (m==0||m==(long long)n*(n-1)/2)
    {
        puts("YES");
        return;
    }
    if (m==n-1)
    {
        int sum=0;
        for (int i=1;i<=n;++i)
            if (d[i]==1)
                ++sum;
        if (sum==n-1)
        {
            puts("YES");
            return;
        }
    }
    if (m==(long long)(n-1)*(n-2)/2)
    {
        int sum=0;
        for (int i=1;i<=n;++i)
            if (d[i]==n-2)
                ++sum;
        if (sum==n-1)
        {
            puts("YES");
            return;
        }
    }
    puts("NO");
}
int main()
{
    int t;
    scanf("%d",&t);
    while (t--)
        solve();
    return 0;
}

详细

Test #1:

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

input:

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

output:

YES
YES
NO

result:

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

Test #2:

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

input:

39982
3 2
2 1
3 2
2 1
1 2
2 1
2 1
3 3
3 1
2 3
1 2
2 1
1 2
3 3
3 1
3 2
2 1
2 1
1 2
3 2
1 2
3 1
3 3
2 1
3 1
2 3
2 1
1 2
3 2
2 1
3 2
3 3
2 3
3 1
2 1
3 3
2 1
1 3
2 3
3 3
3 1
3 2
1 2
2 1
2 1
2 1
2 1
3 1
3 1
2 1
2 1
2 1
1 2
3 2
1 3
3 2
3 2
1 2
1 3
3 2
3 2
1 3
2 1
1 2
3 2
3 2
3 1
3 3
2 3
3 1
1 2
2 1
1 2
3 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 39982 token(s): yes count is 39982, no count is 0

Test #3:

score: -100
Wrong Answer
time: 6ms
memory: 3684kb

input:

33365
3 3
3 1
2 3
2 1
2 1
2 1
4 6
1 2
3 4
4 2
2 3
3 1
4 1
2 1
1 2
2 1
1 2
4 5
1 4
1 2
4 2
3 4
1 3
4 3
4 2
2 1
1 3
3 1
3 2
4 3
1 3
1 2
3 4
3 3
3 2
3 1
2 1
3 1
2 3
3 1
1 3
3 1
2 1
3 2
1 3
3 2
4 5
3 1
4 2
3 4
2 3
2 1
4 2
1 2
3 2
2 1
2 1
3 2
1 2
2 3
3 1
3 2
4 1
3 4
3 1
2 1
4 3
1 2
4 2
3 2
2 1
2 1
4 5
3 ...

output:

YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
...

result:

wrong answer expected YES, found NO [83rd token]