結果
問題 | No.11 カードマッチ |
ユーザー | Grenache |
提出日時 | 2015-11-03 14:09:58 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 163 ms / 5,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 3,800 ms |
コンパイル使用メモリ | 75,012 KB |
実行使用メモリ | 41,616 KB |
最終ジャッジ日時 | 2024-10-11 19:56:41 |
合計ジャッジ時間 | 6,978 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main_yukicoder11 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int w = sc.nextInt(); int h = sc.nextInt(); int n = sc.nextInt(); Set<Integer> hsw = new HashSet<Integer>(); Set<Integer> hsh = new HashSet<Integer>(); for (int i = 0; i < n; i++) { int s = sc.nextInt(); int k = sc.nextInt(); hsw.add(s); hsh.add(k); } System.out.println((long)hsw.size() * h + hsh.size() * w - (long)hsw.size() * hsh.size() - n); sc.close(); } }