QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#88766#5745. Graph Isomorphismbuns_outWA 13ms3408kbC++141.4kb2023-03-17 08:39:032023-03-17 08:39:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-17 08:39:03]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3408kb
  • [2023-03-17 08:39:03]
  • 提交

answer

/*
	嵌套变量重复
	特殊样例 0 1 2 n
	数组越界
	开long long
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pp(x) array<int,x>
using ull=unsigned long long;
using ll=long long;
using pii=pair<int,int>;
const int dx[]={0,0,1,-1,1,-1,1,-1};
const int dy[]={1,-1,0,0,1,-1,-1,1};
const int mod=998244353;
const int inf=0x3f3f3f3f;
const int INF=1e9+7;
const int maxn=1e6+100;
void solve()
{
	int n,m,flag=0;;
	vector<int>in;
	cin>>n>>m;
	in.resize(n+1);
	for(int i=1;i<=m;i++){
		int x,y;
		cin>>x>>y;
		in[x]++;
		in[y]++;
	}
	//n
	if(n<=3)flag=1;
	// jvhua
	int cnt_1=0,cnt_2=0;
	for(int i=1;i<=n;i++)
		if(in[i]==1)cnt_1++;
		else if(in[i]==n-1)cnt_2++;
	if(cnt_1==n-1&&cnt_2==1)flag=1;
	//gudu
	int cnt_a=0,cnt_b=0;
	for(int i=1;i<=n;i++)
		if(in[i]==n-2)cnt_a++;
		else if(in[i]==0)cnt_b++;
	if(cnt_a==n-1&&cnt_b==1)flag=1;
	//si ge cheng huan
	if(n==4)
	{
		if(in[1]==2&&in[2]==2&&in[3]==2&&in[4]==2)flag=1;
		if(in[1]==in[2]&&in[3]==in[4]&&in[1]==in[3]&&in[1]==1)flag=1;
	}
	if(flag)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}
signed main(){
 // freopen("C:\\Users\\tob\\Desktop\\P1000_0.in.txt","r",stdin);
 // freopen("C:\\Users\\tob\\Desktop\\P1000_0.out.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(nullptr);cout.tie(nullptr);
	int __;cin>>__;
	while(__--)
		solve();
//  fclose(stdin);
//  fclose(stdout);
	return 0;
}

详细

Test #1:

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

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: 11ms
memory: 3408kb

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: 13ms
memory: 3408kb

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
NO
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
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
Y...

result:

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