結果

問題 No.11 カードマッチ
ユーザー GrenacheGrenache
提出日時 2015-11-03 14:09:58
言語 Java19
(openjdk 21)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 687 bytes
コンパイル時間 3,229 ms
コンパイル使用メモリ 72,028 KB
実行使用メモリ 56,472 KB
最終ジャッジ日時 2023-08-02 00:14:20
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,028 KB
testcase_01 AC 118 ms
56,308 KB
testcase_02 AC 118 ms
56,020 KB
testcase_03 AC 116 ms
56,304 KB
testcase_04 AC 132 ms
56,052 KB
testcase_05 AC 114 ms
56,032 KB
testcase_06 AC 135 ms
56,472 KB
testcase_07 AC 140 ms
56,188 KB
testcase_08 AC 136 ms
55,584 KB
testcase_09 AC 131 ms
56,272 KB
testcase_10 AC 128 ms
55,992 KB
testcase_11 AC 133 ms
56,400 KB
testcase_12 AC 132 ms
56,324 KB
testcase_13 AC 133 ms
55,788 KB
testcase_14 AC 136 ms
56,224 KB
testcase_15 AC 135 ms
56,176 KB
testcase_16 AC 136 ms
56,200 KB
testcase_17 AC 133 ms
56,160 KB
testcase_18 AC 132 ms
56,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


public class Main_yukicoder11 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int w = sc.nextInt();
        int h = sc.nextInt();
        int n = sc.nextInt();

        Set<Integer> hsw = new HashSet<Integer>();
        Set<Integer> hsh = new HashSet<Integer>();

        for (int i = 0; i < n; i++) {
        	int s = sc.nextInt();
        	int k = sc.nextInt();
        	hsw.add(s);
        	hsh.add(k);
        }

        System.out.println((long)hsw.size() * h + hsh.size() * w - (long)hsw.size() * hsh.size() - n);
        
        sc.close();
    }
}
0