結果

問題 No.11 カードマッチ
ユーザー bambambambam
提出日時 2019-08-22 13:30:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 182 ms / 5,000 ms
コード長 642 bytes
コンパイル時間 2,505 ms
コンパイル使用メモリ 75,056 KB
実行使用メモリ 41,684 KB
最終ジャッジ日時 2024-04-20 12:49:30
合計ジャッジ時間 6,516 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
41,396 KB
testcase_01 AC 140 ms
41,264 KB
testcase_02 AC 142 ms
41,400 KB
testcase_03 AC 142 ms
41,260 KB
testcase_04 AC 158 ms
41,620 KB
testcase_05 AC 140 ms
41,340 KB
testcase_06 AC 156 ms
41,536 KB
testcase_07 AC 160 ms
41,496 KB
testcase_08 AC 182 ms
41,488 KB
testcase_09 AC 159 ms
41,668 KB
testcase_10 AC 150 ms
41,316 KB
testcase_11 AC 167 ms
41,684 KB
testcase_12 AC 156 ms
41,448 KB
testcase_13 AC 153 ms
41,468 KB
testcase_14 AC 154 ms
41,332 KB
testcase_15 AC 154 ms
41,620 KB
testcase_16 AC 157 ms
41,336 KB
testcase_17 AC 165 ms
41,616 KB
testcase_18 AC 148 ms
41,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;

public class Main {
	static boolean memo[];
	static int ans, min;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		long w = sc.nextLong();
		long h = sc.nextLong();
		int n = sc.nextInt();
		HashSet<Integer> hs1 = new HashSet<>();
		HashSet<Integer> hs2 = new HashSet<>();
		int mark, num;
		long sum;
		for (int i = 0; i < n; i++) {
			mark = sc.nextInt();
			num = sc.nextInt();
			hs1.add(mark);
			hs2.add(num);
		}
		sum = hs1.size() * h + (w - hs1.size()) * hs2.size() - n;
		System.out.println(sum);
	}
}
0