QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#633014 | #7755. Game on a Forest | tsai | WA | 3ms | 27144kb | C++14 | 695b | 2024-10-12 14:22:31 | 2024-10-12 14:22:31 |
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++;
}
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: 0
Wrong Answer
time: 3ms
memory: 27144kb
input:
3 1 1 2
output:
3
result:
wrong answer 1st numbers differ - expected: '2', found: '3'