QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#633058 | #7755. Game on a Forest | tsai | WA | 5ms | 27388kb | C++14 | 700b | 2024-10-12 14:27:51 | 2024-10-12 14:27:51 |
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(n%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: 27388kb
input:
3 1 1 2
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 5ms
memory: 27252kb
input:
4 3 1 2 2 3 3 4
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 27348kb
input:
100000 1 4647 17816
output:
99999
result:
wrong answer 1st numbers differ - expected: '1', found: '99999'