QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#633003#7755. Game on a ForesttsaiWA 5ms27276kbC++14706b2024-10-12 14:21:112024-10-12 14:21:12

Judging History

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

  • [2024-10-12 14:21:12]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:27276kb
  • [2024-10-12 14:21:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int>v[1000050];
void solve(){
	int n,m;
	scanf("%d %d", &n,&m);
    for(int i=1;i<=n;i++){
    	v[i].clear();
	}
    for(int i=1;i<=m;i++){
    	int x,y;
    	scanf("%d %d",&x,&y);
    	v[x].push_back(y);
    	v[y].push_back(x);
	}
    int point=0;//孤点
    int okpoint=0;
    for(int i=1;i<=n;i++){
    	if(v[i].size()==0){
    		point++;
		}else{
			okpoint++;
		}
	}
    if(okpoint%2==0){
    	printf("%d",m+point);
	}else{
		printf("%d",okpoint);
	}
    
    return ;
}

int main(){
//	int t;
//	scanf("%d",&t);
//	while(t--){
		solve();
//		if(t) printf("\n");
//	}
	
	return 0;	
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 27144kb

input:

3 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 3ms
memory: 27256kb

input:

4 3
1 2
2 3
3 4

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: -100
Wrong Answer
time: 5ms
memory: 27276kb

input:

100000 1
4647 17816

output:

99999

result:

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