結果

問題 No.11 カードマッチ
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-02-24 12:27:57
言語 Java19
(openjdk 21)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 704 bytes
コンパイル時間 3,535 ms
コンパイル使用メモリ 73,092 KB
実行使用メモリ 56,264 KB
最終ジャッジ日時 2023-08-23 11:07:29
合計ジャッジ時間 7,531 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,552 KB
testcase_01 AC 124 ms
55,540 KB
testcase_02 AC 125 ms
55,556 KB
testcase_03 AC 123 ms
55,932 KB
testcase_04 AC 141 ms
56,236 KB
testcase_05 AC 123 ms
55,536 KB
testcase_06 AC 143 ms
56,192 KB
testcase_07 AC 144 ms
56,264 KB
testcase_08 AC 145 ms
55,908 KB
testcase_09 AC 143 ms
56,084 KB
testcase_10 AC 137 ms
55,648 KB
testcase_11 AC 142 ms
55,668 KB
testcase_12 AC 143 ms
55,620 KB
testcase_13 AC 139 ms
55,780 KB
testcase_14 AC 141 ms
55,736 KB
testcase_15 AC 142 ms
55,624 KB
testcase_16 AC 143 ms
55,580 KB
testcase_17 AC 144 ms
55,576 KB
testcase_18 AC 143 ms
55,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Mian {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        
        Set<Integer> c1 = new HashSet<>();
        Set<Integer> c2 = new HashSet<>();
        
        int w = stdin.nextInt();
        int h = stdin.nextInt();
        int n = stdin.nextInt();
        for (int time = 0; time < n; time++) {
            int s = stdin.nextInt();
            int k = stdin.nextInt();
            c1.add(s);
            c2.add(k);
        }
        
        int ans = (c1.size() * h) + (c2.size() * w) - (c1.size() * c2.size()) - n;
        System.out.println(ans);
    }

}
0