結果

問題 No.11 カードマッチ
ユーザー tentententen
提出日時 2020-11-17 08:30:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 572 bytes
コンパイル時間 2,133 ms
コンパイル使用メモリ 73,556 KB
実行使用メモリ 57,776 KB
最終ジャッジ日時 2023-09-30 07:40:35
合計ジャッジ時間 5,833 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,696 KB
testcase_01 AC 127 ms
55,596 KB
testcase_02 AC 128 ms
55,804 KB
testcase_03 AC 126 ms
57,776 KB
testcase_04 AC 143 ms
55,628 KB
testcase_05 AC 124 ms
56,024 KB
testcase_06 AC 144 ms
56,008 KB
testcase_07 AC 147 ms
55,948 KB
testcase_08 AC 145 ms
55,712 KB
testcase_09 AC 142 ms
55,672 KB
testcase_10 AC 138 ms
56,036 KB
testcase_11 AC 143 ms
55,708 KB
testcase_12 AC 142 ms
55,988 KB
testcase_13 AC 143 ms
55,864 KB
testcase_14 AC 145 ms
55,472 KB
testcase_15 AC 141 ms
55,972 KB
testcase_16 AC 145 ms
53,728 KB
testcase_17 AC 141 ms
56,096 KB
testcase_18 AC 141 ms
55,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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> suits = new HashSet<>();
        HashSet<Integer> numbers = new HashSet<>();
        for (int i = 0; i < n; i++) {
            suits.add(sc.nextInt());
            numbers.add(sc.nextInt());
        }
        long ans = suits.size() * ((long)h - numbers.size()) + numbers.size() * w - n;
        System.out.print(ans);
    }
}
0