結果

問題 No.11 カードマッチ
ユーザー rn4rurn4ru
提出日時 2016-04-13 02:34:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 583 bytes
コンパイル時間 1,807 ms
コンパイル使用メモリ 75,592 KB
実行使用メモリ 54,444 KB
最終ジャッジ日時 2024-04-20 01:15:48
合計ジャッジ時間 4,824 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
54,004 KB
testcase_01 AC 108 ms
53,848 KB
testcase_02 AC 122 ms
53,864 KB
testcase_03 AC 112 ms
54,048 KB
testcase_04 AC 130 ms
54,380 KB
testcase_05 AC 117 ms
53,624 KB
testcase_06 AC 121 ms
54,064 KB
testcase_07 AC 122 ms
54,444 KB
testcase_08 AC 123 ms
53,876 KB
testcase_09 AC 135 ms
54,380 KB
testcase_10 AC 122 ms
54,168 KB
testcase_11 AC 121 ms
54,304 KB
testcase_12 AC 122 ms
53,948 KB
testcase_13 AC 124 ms
54,308 KB
testcase_14 AC 123 ms
53,972 KB
testcase_15 AC 120 ms
54,124 KB
testcase_16 AC 122 ms
53,588 KB
testcase_17 AC 129 ms
54,084 KB
testcase_18 AC 125 ms
54,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int W = scanner.nextInt();
		int H = scanner.nextInt();
		int N = scanner.nextInt();
		Set<Integer> Wsum = new HashSet<>();
		Set<Integer> Hsum = new HashSet<>();
		for (int i = 0; i < N; i++) {
			int S = scanner.nextInt();
			int K = scanner.nextInt();
			Wsum.add(S);
			Hsum.add(K);
		}
		System.out.println(W * H - (W - Wsum.size()) * (H - Hsum.size()) - N);
	}

}
0