Last active
May 22, 2019 22:43
-
-
Save Rockbet/8af5fa8e1795416287b0c37cd36cc236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
using namespace std; | |
int main(){ | |
int n, m; | |
cin >> n >> m; | |
vector<int> a(n), b(m); | |
for(int i = 0; i < n; ++i){ | |
cin >> a[i]; | |
} | |
for(int i = 0; i < m; i++){ | |
cin >> b[i]; | |
} | |
int c0 = 0, c1 = 0; | |
for(int i = 0; i < n; i++){ | |
if (a[i]%2 == 0){ | |
c0++; | |
} | |
else{ | |
c1++; | |
} | |
} | |
int k0 = 0, k1 = 0; | |
for(int i = 0; i < m; i++){ | |
if (b[i]%2 == 0){ | |
k0++; | |
} | |
else{ | |
k1++; | |
} | |
} | |
int ans = min(c1, k0) + min(c0, k1); | |
cout << ans << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment