187612025-11-04 17:07:07algoproEmezen Rt.cpp17Wrong answer 0/100194ms6708 KiB
// UUID: d1b23f03-22ba-44bf-b460-1d532ae486b0
#include <bits/stdc++.h>
using namespace std;

void solve(){
	int n,m;cin>>n>>m;
	vector<vector<int>>g(n+1);
	for(int i=1;i<=m;i++){
		int u,v;cin>>u>>v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	vector<bool>ans(n+1,false);
	int c=0;
	for(int i=1;i<=n;i++){
		int cnt=0;
		for(int x:g[i]){
			if(ans[x])cnt++;
		}
		if(cnt<=g[i].size()/2){
			ans[i]=true;
			c++;
		}
	}
	//cout<<c<<"\n";
	//for(int i=1;i<=n;i++)if(ans[i])cout<<i<<' ';
	//cout<<"\n";
	cout<<"-1\n-1\n";
}

int main() {
	int t;cin>>t;
	while(t--)solve();
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer1ms316 KiB
subtask20/16
2Wrong answer1ms508 KiB
3Wrong answer1ms500 KiB
4Wrong answer1ms316 KiB
5Wrong answer1ms316 KiB
6Wrong answer1ms316 KiB
7Wrong answer1ms316 KiB
8Wrong answer1ms548 KiB
9Wrong answer1ms316 KiB
10Wrong answer1ms316 KiB
11Wrong answer1ms316 KiB
12Wrong answer1ms316 KiB
13Wrong answer1ms316 KiB
14Wrong answer1ms316 KiB
15Wrong answer1ms316 KiB
16Wrong answer1ms508 KiB
subtask30/18
17Wrong answer52ms1556 KiB
18Wrong answer112ms3020 KiB
19Wrong answer115ms2636 KiB
20Wrong answer8ms2612 KiB
21Wrong answer92ms5428 KiB
22Wrong answer129ms6268 KiB
23Wrong answer168ms4916 KiB
24Wrong answer162ms5684 KiB
25Wrong answer185ms6644 KiB
26Wrong answer174ms6648 KiB
subtask40/66
27Wrong answer8ms2868 KiB
28Wrong answer24ms3728 KiB
29Wrong answer48ms4404 KiB
30Wrong answer136ms5984 KiB
31Wrong answer190ms6708 KiB
32Wrong answer194ms6656 KiB
33Wrong answer172ms6452 KiB
34Wrong answer177ms5936 KiB
35Wrong answer116ms2872 KiB
36Wrong answer114ms2868 KiB
37Wrong answer2ms316 KiB
38Wrong answer6ms564 KiB
39Wrong answer17ms820 KiB
40Wrong answer2ms316 KiB
41Wrong answer2ms316 KiB
42Wrong answer120ms432 KiB
43Wrong answer43ms408 KiB
44Wrong answer6ms316 KiB
45Wrong answer2ms316 KiB