QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#643729 | #7755. Game on a Forest | Yu_mx | WA | 0ms | 8348kb | C++14 | 774b | 2024-10-15 23:30:05 | 2024-10-15 23:30:05 |
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 if(sg == 2)cout<<cnt1<<endl;
else cout<<0<<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: 0
Wrong Answer
time: 0ms
memory: 8348kb
input:
3 1 1 2
output:
0
result:
wrong answer 1st numbers differ - expected: '2', found: '0'