QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88768 | #5745. Graph Isomorphism | buns_out | WA | 19ms | 26976kb | C++14 | 1.8kb | 2023-03-17 08:43:13 | 2023-03-17 08:43:16 |
Judging History
answer
/*
嵌套变量重复
特殊样例 0 1 2 n
数组越界
开long long
*/
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
#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;
vector<int>v[maxn];
void solve()
{
int n,m;
cin>>n>>m;
int tmp=(1+n-1)*(n-1)/2;
for(int i=1;i<=n;i++)
v[i].clear();
for(int i=1;i<=m;i++){
int x,y;
cin>>x>>y;
v[x].push_back(y);
v[y].push_back(x);
}
if(n<=3||m==tmp)cout<<"YES"<<endl;
else if(m!=tmp&&n!=4)cout<<"NO"<<endl;
else if(n==4)
{
if(m==2&&v[1].size()==1&&v[2].size()==1&&v[3].size()==1&&v[4].size()==1)cout<<"YES"<<endl;
else if(m==4&&v[1].size()==2&&v[2].size()==2&&v[3].size()==2&&v[4].size()==2)cout<<"YES"<<endl;
else if(m==3&&(v[1].size()==0||v[2].size()==0||v[3].size()==0||v[4].size()==0))cout<<"YES"<<endl;
else if(m==3&&v[1].size()==3&&v[2].size()==1&&v[3].size()==1&&v[4].size()==1)cout<<"YES"<<endl;
else if(m==3&&v[1].size()==1&&v[2].size()==3&&v[3].size()==1&&v[4].size()==1)cout<<"YES"<<endl;
else if(m==3&&v[1].size()==1&&v[2].size()==1&&v[3].size()==3&&v[4].size()==1)cout<<"YES"<<endl;
else if(m==3&&v[1].size()==1&&v[2].size()==1&&v[3].size()==1&&v[4].size()==3)cout<<"YES"<<endl;
else cout<<"NO"<<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: 12ms
memory: 26976kb
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: 19ms
memory: 26780kb
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: 0
Accepted
time: 18ms
memory: 26820kb
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:
ok 33365 token(s): yes count is 25608, no count is 7757
Test #4:
score: -100
Wrong Answer
time: 16ms
memory: 26872kb
input:
28572 3 3 1 3 2 1 3 2 2 1 1 2 4 1 4 2 3 2 1 2 2 3 5 2 4 3 4 2 2 1 2 1 3 1 1 3 5 10 1 3 3 5 1 2 4 3 4 5 4 1 5 1 4 2 2 5 3 2 4 4 2 1 1 3 2 4 1 4 2 1 1 2 4 4 1 3 4 2 4 1 2 1 4 3 1 4 3 1 4 2 5 2 2 1 4 5 4 1 3 4 5 5 2 5 3 1 4 1 2 3 1 5 5 3 5 4 3 5 2 3 4 1 4 3 3 2 2 3 1 2 2 1 2 1 4 5 3 2 3 4 4 1 3 1 2 1 3...
output:
YES YES NO YES NO YES YES YES NO YES NO NO NO NO NO NO NO YES YES NO YES NO YES YES YES NO YES YES NO YES YES YES NO NO YES NO NO YES NO NO YES NO NO NO NO YES YES YES NO YES YES NO NO NO YES YES NO YES YES NO NO YES YES YES YES YES NO YES YES YES YES YES YES NO YES YES NO NO NO NO YES YES YES YES Y...
result:
wrong answer expected YES, found NO [34th token]