QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#643728 | #7755. Game on a Forest | Yu_mx | WA | 2ms | 8308kb | C++14 | 733b | 2024-10-15 23:28:18 | 2024-10-15 23:28:19 |
Judging History
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'