QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#643728#7755. Game on a ForestYu_mxWA 2ms8308kbC++14733b2024-10-15 23:28:182024-10-15 23:28:19

Judging History

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

  • [2024-10-15 23:28:19]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:8308kb
  • [2024-10-15 23:28:18]
  • 提交

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 cout<<cnt1<<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: 100
Accepted
time: 0ms
memory: 8308kb

input:

3 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 2ms
memory: 8272kb

input:

4 3
1 2
2 3
3 4

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: 0
Accepted
time: 0ms
memory: 8176kb

input:

100000 1
4647 17816

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 8296kb

input:

100000 2
64075 72287
63658 66936

output:

4

result:

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