結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  neko_the_shadow | 
| 提出日時 | 2019-02-24 12:27:57 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 134 ms / 5,000 ms | 
| コード長 | 704 bytes | 
| コンパイル時間 | 3,272 ms | 
| コンパイル使用メモリ | 75,216 KB | 
| 実行使用メモリ | 41,908 KB | 
| 最終ジャッジ日時 | 2024-12-21 13:28:03 | 
| 合計ジャッジ時間 | 6,530 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Mian {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        
        Set<Integer> c1 = new HashSet<>();
        Set<Integer> c2 = new HashSet<>();
        
        int w = stdin.nextInt();
        int h = stdin.nextInt();
        int n = stdin.nextInt();
        for (int time = 0; time < n; time++) {
            int s = stdin.nextInt();
            int k = stdin.nextInt();
            c1.add(s);
            c2.add(k);
        }
        
        int ans = (c1.size() * h) + (c2.size() * w) - (c1.size() * c2.size()) - n;
        System.out.println(ans);
    }
}
            
            
            
        