結果

問題 No.11 カードマッチ
ユーザー tsunabittsunabit
提出日時 2019-08-16 22:44:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 5,000 ms
コード長 589 bytes
コンパイル時間 4,783 ms
コンパイル使用メモリ 74,916 KB
実行使用メモリ 57,804 KB
最終ジャッジ日時 2023-10-24 02:12:30
合計ジャッジ時間 8,744 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
57,484 KB
testcase_01 AC 133 ms
57,472 KB
testcase_02 AC 129 ms
57,552 KB
testcase_03 AC 117 ms
56,344 KB
testcase_04 AC 144 ms
57,692 KB
testcase_05 AC 129 ms
57,572 KB
testcase_06 AC 143 ms
57,796 KB
testcase_07 AC 156 ms
57,804 KB
testcase_08 AC 146 ms
57,620 KB
testcase_09 AC 157 ms
57,692 KB
testcase_10 AC 138 ms
57,644 KB
testcase_11 AC 143 ms
57,788 KB
testcase_12 AC 142 ms
57,388 KB
testcase_13 AC 140 ms
57,636 KB
testcase_14 AC 142 ms
57,780 KB
testcase_15 AC 145 ms
57,664 KB
testcase_16 AC 142 ms
57,776 KB
testcase_17 AC 142 ms
57,628 KB
testcase_18 AC 146 ms
57,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No11 {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt(), h = sc.nextInt(), n = sc.nextInt();
    	HashSet<Integer> ma = new HashSet<Integer>();
    	HashSet<Integer> su = new HashSet<Integer>();
    	for(int i = 0; i < n; i++) {
    		ma.add(sc.nextInt());
    		su.add(sc.nextInt());
    	}
    	// マッチするマーク + マッチする数字 - 重複カウント - 手札
    	System.out.println(ma.size()*h+su.size()*w-ma.size()*su.size()-n);
	}
}
0