QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#633003 | #7755. Game on a Forest | tsai | WA | 5ms | 27276kb | C++14 | 706b | 2024-10-12 14:21:11 | 2024-10-12 14:21:12 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'