結果

問題 No.11 カードマッチ
ユーザー tsunabit
提出日時 2019-08-16 22:44:14
言語 Java
(openjdk 23)
結果
AC  
実行時間 151 ms / 5,000 ms
コード長 589 bytes
コンパイル時間 3,528 ms
コンパイル使用メモリ 80,252 KB
実行使用メモリ 54,608 KB
最終ジャッジ日時 2024-09-22 19:07:33
合計ジャッジ時間 7,160 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No11 {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int w = sc.nextInt(), h = sc.nextInt(), n = sc.nextInt();
    	HashSet<Integer> ma = new HashSet<Integer>();
    	HashSet<Integer> su = new HashSet<Integer>();
    	for(int i = 0; i < n; i++) {
    		ma.add(sc.nextInt());
    		su.add(sc.nextInt());
    	}
    	// マッチするマーク + マッチする数字 - 重複カウント - 手札
    	System.out.println(ma.size()*h+su.size()*w-ma.size()*su.size()-n);
	}
}
0