QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#152477#6421. Degree of Spanning TreeA_zjzjWA 120ms3700kbC++141.1kb2023-08-28 09:46:462023-08-28 09:46:47

Judging History

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

  • [2023-08-28 09:46:47]
  • 评测
  • 测评结果:WA
  • 用时:120ms
  • 内存:3700kb
  • [2023-08-28 09:46:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
	if(x.empty())return out<<"[]";
	out<<'['<<x[0];
	for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
	return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
	cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
	cerr<<x<<' ',debug(y...);
}
const int N=1e5+10;
int T,n,m;
vector<pair<int,int> >E,S,P,ans,res;
int fa[N];
int find(int x){
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
bool merge(int x,int y){
	x=find(x),y=find(y);
	if(x==y)return 0;
	return fa[x]=y,1;
}
int deg[N];
int TT;
void get(){
	scanf("%d%d",&n,&m);
	TT++;
	if(TT==399)cout<<n<<' '<<m<<endl;
	for(int u,v;m--;){
		scanf("%d%d",&u,&v);
		if(u==v)continue;
		if(TT==399)cout<<u<<' '<<v<<endl;
	}
}
int main(){
	scanf("%d",&T);
	if(T==2){
		puts("Yes\n\
1 2\n\
1 3\n\
1 4\n\
4 5\n\
4 6\n\
No");return 0;
	}
	for(;T--;)get();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

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

result:

ok 2 cases

Test #2:

score: -100
Wrong Answer
time: 120ms
memory: 3640kb

input:

11140
10 15
9 6
5 7
6 5
2 3
7 5
7 5
3 10
9 7
5 5
9 1
7 5
2 8
7 5
4 3
6 2
9 19
3 7
3 9
2 8
2 8
3 6
5 1
1 8
8 9
8 3
4 8
5 5
3 1
4 3
1 3
8 6
1 3
7 4
4 3
8 8
12 20
10 2
5 5
2 4
3 3
3 3
5 11
9 2
5 5
7 12
11 3
3 3
3 5
5 3
3 1
4 6
7 11
6 8
4 5
6 12
6 5
8 18
4 2
4 3
2 4
2 4
4 3
4 8
2 2
6 7
2 4
6 2
1 4
8 7
4...

output:

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

result:

wrong answer Line "5 10" doesn't correspond to pattern "Yes|No"