結果

問題 No.11 カードマッチ
ユーザー ぴろずぴろず
提出日時 2014-12-20 23:16:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 158 ms / 5,000 ms
コード長 532 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 75,540 KB
実行使用メモリ 41,892 KB
最終ジャッジ日時 2024-04-20 00:15:18
合計ジャッジ時間 5,337 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
41,260 KB
testcase_01 AC 116 ms
41,400 KB
testcase_02 AC 116 ms
41,656 KB
testcase_03 AC 118 ms
41,236 KB
testcase_04 AC 132 ms
41,364 KB
testcase_05 AC 121 ms
41,244 KB
testcase_06 AC 150 ms
41,328 KB
testcase_07 AC 158 ms
41,624 KB
testcase_08 AC 133 ms
41,356 KB
testcase_09 AC 126 ms
41,780 KB
testcase_10 AC 133 ms
41,868 KB
testcase_11 AC 127 ms
41,736 KB
testcase_12 AC 133 ms
41,476 KB
testcase_13 AC 136 ms
41,604 KB
testcase_14 AC 139 ms
41,892 KB
testcase_15 AC 128 ms
41,712 KB
testcase_16 AC 127 ms
41,852 KB
testcase_17 AC 144 ms
41,616 KB
testcase_18 AC 148 ms
41,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no011;

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int n = sc.nextInt();
		HashSet<Integer> S = new HashSet<>();
		HashSet<Integer> K = new HashSet<>();
		for(int i=0;i<n;i++) {
			int s = sc.nextInt();
			int k = sc.nextInt();
			S.add(s);
			K.add(k);
		}
		System.out.println((long) S.size() * h + (long) K.size() * w - n - (long) S.size() * K.size());
	}

}
0