SHARE
TWEET

Untitled

MrSossa Feb 24th, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. public class Neko {
  5.     public static void main(String[] args) {
  6.         Scanner read = new Scanner(System.in);
  7.         int n = read.nextInt();
  8.         int m = read.nextInt();
  9.         ArrayList<Integer> chess=new ArrayList<>();
  10.         for (int i = 0; i < n; i++) {
  11.             chess.add(read.nextInt());
  12.         }
  13.         int ans=0;
  14.         for (int i = 0; i < m; i++) {
  15.             int keys = read.nextInt();
  16.             for (int j = 0; j < chess.size(); j++) {
  17.                 if ((chess.get(j)+keys)%2!=0) {
  18.                     ans+=1;
  19.                     chess.remove(j);
  20.                     break;
  21.                 }
  22.             }
  23.         }
  24.         System.out.println(ans);
  25.     }
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top