結果

問題 No.11 カードマッチ
ユーザー jp_stejp_ste
提出日時 2016-03-02 13:52:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 150 ms / 5,000 ms
コード長 690 bytes
コンパイル時間 2,248 ms
コンパイル使用メモリ 75,108 KB
実行使用メモリ 41,868 KB
最終ジャッジ日時 2024-04-20 01:14:26
合計ジャッジ時間 5,365 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
40,828 KB
testcase_01 AC 103 ms
41,380 KB
testcase_02 AC 115 ms
41,196 KB
testcase_03 AC 112 ms
41,412 KB
testcase_04 AC 140 ms
41,388 KB
testcase_05 AC 114 ms
41,368 KB
testcase_06 AC 123 ms
41,760 KB
testcase_07 AC 150 ms
41,484 KB
testcase_08 AC 127 ms
41,868 KB
testcase_09 AC 132 ms
41,500 KB
testcase_10 AC 121 ms
41,640 KB
testcase_11 AC 124 ms
41,496 KB
testcase_12 AC 130 ms
41,796 KB
testcase_13 AC 129 ms
41,276 KB
testcase_14 AC 123 ms
41,464 KB
testcase_15 AC 137 ms
41,740 KB
testcase_16 AC 129 ms
41,364 KB
testcase_17 AC 141 ms
41,468 KB
testcase_18 AC 142 ms
41,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) {
        try (Scanner scan = new Scanner(System.in)) {
            int W = scan.nextInt();
            int H = scan.nextInt();
            int N = scan.nextInt();
            HashSet<Integer> wList = new HashSet<>();
            HashSet<Integer> hList = new HashSet<>();
            for(int i=0; i<N; i++) {
                wList.add(scan.nextInt());
                hList.add(scan.nextInt());
            }
            int w = wList.size();
            int h = hList.size();
            int ans = w*H + h*W - w*h - N;
            System.out.println(ans);
        }
    }
}
0