QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#643729#7755. Game on a ForestYu_mxWA 0ms8348kbC++14774b2024-10-15 23:30:052024-10-15 23:30:05

Judging History

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

  • [2024-10-15 23:30:05]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:8348kb
  • [2024-10-15 23:30:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'

const int N = 2e5+5;

vector<ll> v[N];

void solve(){
	ll n ,m;
	cin>>n>>m;
	ll sg = 0;
	ll cnt1 = 0, cnt2 = 0;
	for(int i=1;i<=m;i++){
		ll x,y;
		cin>>x>>y;
		v[x].push_back(y);
		v[y].push_back(x);
		sg ^= 1;
		cnt2++;
	}
	for(int i=1;i<=n;i++){
		if(v[i].size()){
			if(v[i].size()%2) sg ^= 2,cnt1++;
			else sg ^= 1;
		}
		else sg ^= 1;
	}
	//cout<<sg<<endl;
//	if(sg == 0 && sg == 3){
//		cout<<0<<endl;
//		return;
//	}
	if(sg == 1) cout<<cnt2<<endl;
	else if(sg == 2)cout<<cnt1<<endl; 
	else cout<<0<<endl;
}

int main(){
	ios;
	//ll T;cin>>T;while(T--)
	solve();
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 8348kb

input:

3 1
1 2

output:

0

result:

wrong answer 1st numbers differ - expected: '2', found: '0'