結果

問題 No.11 カードマッチ
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-25 18:06:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 613 bytes
コンパイル時間 1,977 ms
コンパイル使用メモリ 72,572 KB
実行使用メモリ 56,036 KB
最終ジャッジ日時 2023-08-18 07:36:33
合計ジャッジ時間 6,076 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
55,656 KB
testcase_01 AC 118 ms
55,884 KB
testcase_02 AC 116 ms
55,640 KB
testcase_03 AC 117 ms
55,852 KB
testcase_04 AC 124 ms
55,664 KB
testcase_05 AC 117 ms
55,848 KB
testcase_06 AC 126 ms
55,640 KB
testcase_07 AC 123 ms
55,820 KB
testcase_08 AC 125 ms
55,884 KB
testcase_09 AC 124 ms
56,016 KB
testcase_10 AC 125 ms
55,848 KB
testcase_11 AC 126 ms
55,652 KB
testcase_12 AC 126 ms
55,848 KB
testcase_13 AC 122 ms
55,684 KB
testcase_14 AC 122 ms
56,036 KB
testcase_15 AC 125 ms
55,680 KB
testcase_16 AC 123 ms
55,684 KB
testcase_17 AC 125 ms
55,808 KB
testcase_18 AC 123 ms
55,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long W = sc.nextLong();
        long H = sc.nextLong();
        long N = sc.nextLong();
        Set<String> SSet = new HashSet<>();
        Set<String> KSet = new HashSet<>();
        for(int i=0; i<N; i++){
            String S = sc.next();
            SSet.add(S);
            String K = sc.next();
            KSet.add(K);
        }
        long a = SSet.size();
        long b = KSet.size();
        long ans = W*H-(W-a)*(H-b)-N;
        System.out.println(ans);
    }
}
0