結果

問題 No.11 カードマッチ
コンテスト
ユーザー bambam
提出日時 2019-08-22 13:30:25
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 70 ms / 5,000 ms
+ 552µs
コード長 642 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,525 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 43,344 KB
最終ジャッジ日時 2026-09-14 14:40:39
合計ジャッジ時間 4,616 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

public class Main {
	static boolean memo[];
	static int ans, min;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();
		long w = sc.nextLong();
		long h = sc.nextLong();
		int n = sc.nextInt();
		HashSet<Integer> hs1 = new HashSet<>();
		HashSet<Integer> hs2 = new HashSet<>();
		int mark, num;
		long sum;
		for (int i = 0; i < n; i++) {
			mark = sc.nextInt();
			num = sc.nextInt();
			hs1.add(mark);
			hs2.add(num);
		}
		sum = hs1.size() * h + (w - hs1.size()) * hs2.size() - n;
		System.out.println(sum);
	}
}
0