結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  tenten | 
| 提出日時 | 2020-11-17 08:30:53 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 162 ms / 5,000 ms | 
| コード長 | 572 bytes | 
| コンパイル時間 | 2,179 ms | 
| コンパイル使用メモリ | 75,328 KB | 
| 実行使用メモリ | 54,436 KB | 
| 最終ジャッジ日時 | 2024-07-23 01:54:58 | 
| 合計ジャッジ時間 | 5,849 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();
        HashSet<Integer> suits = new HashSet<>();
        HashSet<Integer> numbers = new HashSet<>();
        for (int i = 0; i < n; i++) {
            suits.add(sc.nextInt());
            numbers.add(sc.nextInt());
        }
        long ans = suits.size() * ((long)h - numbers.size()) + numbers.size() * w - n;
        System.out.print(ans);
    }
}
            
            
            
        