Submission #2406696


Source Code Expand

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.HashMap;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        
        HashMap<String, Integer> cards = new HashMap<String, Integer>();
        
        for (int i = 0; i < n; i++) {
            String key = br.readLine();
            if (cards.get(key) == null) cards.put(key, 1);
            else cards.put(key, cards.get(key) + 1);
        }
        
        int m = Integer.parseInt(br.readLine());
        
        for (int i = 0; i < m; i++) {
            String key = br.readLine();
            if (cards.get(key) == null) cards.put(key, -1);
            else cards.put(key, cards.get(key) - 1);
        }
        
        int max = 0;
        for (int value : cards.values()) {
            if (max < value) max = value;
        }
        
        System.out.println(max);
    }
}

Submission Info

Submission Time
Task B - Two Colors Card Game
User KeiG
Language Java8 (OpenJDK 1.8.0)
Score 200
Code Size 1123 Byte
Status AC
Exec Time 70 ms
Memory 21332 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 11
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All example_0, example_1, example_2, example_3, rand_0, rand_1, rand_2, rand_3, rand_4, rand_5, rand_6
Case Name Status Exec Time Memory
example_0 AC 68 ms 19540 KB
example_1 AC 67 ms 21332 KB
example_2 AC 67 ms 19284 KB
example_3 AC 68 ms 18644 KB
rand_0 AC 69 ms 18132 KB
rand_1 AC 70 ms 19028 KB
rand_2 AC 68 ms 18388 KB
rand_3 AC 68 ms 18388 KB
rand_4 AC 67 ms 17748 KB
rand_5 AC 69 ms 18772 KB
rand_6 AC 69 ms 19156 KB