Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Neko {
- public static void main(String[] args) {
- Scanner read = new Scanner(System.in);
- int n = read.nextInt();
- int m = read.nextInt();
- ArrayList<Integer> chess=new ArrayList<>();
- for (int i = 0; i < n; i++) {
- chess.add(read.nextInt());
- }
- int ans=0;
- for (int i = 0; i < m; i++) {
- int keys = read.nextInt();
- for (int j = 0; j < chess.size(); j++) {
- if ((chess.get(j)+keys)%2!=0) {
- ans+=1;
- chess.remove(j);
- break;
- }
- }
- }
- System.out.println(ans);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement