結果
問題 |
No.11 カードマッチ
|
ユーザー |
![]() |
提出日時 | 2016-03-02 13:52:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 161 ms / 5,000 ms |
コード長 | 690 bytes |
コンパイル時間 | 2,218 ms |
コンパイル使用メモリ | 75,768 KB |
実行使用メモリ | 41,976 KB |
最終ジャッジ日時 | 2024-10-11 20:02:42 |
合計ジャッジ時間 | 5,803 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import java.util.HashSet; import java.util.Scanner; public class Main { public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { int W = scan.nextInt(); int H = scan.nextInt(); int N = scan.nextInt(); HashSet<Integer> wList = new HashSet<>(); HashSet<Integer> hList = new HashSet<>(); for(int i=0; i<N; i++) { wList.add(scan.nextInt()); hList.add(scan.nextInt()); } int w = wList.size(); int h = hList.size(); int ans = w*H + h*W - w*h - N; System.out.println(ans); } } }