結果

問題 No.11 カードマッチ
ユーザー kou6839
提出日時 2014-11-11 13:35:57
言語 Java
(openjdk 23)
結果
AC  
実行時間 153 ms / 5,000 ms
コード長 435 bytes
コンパイル時間 2,169 ms
コンパイル使用メモリ 75,656 KB
実行使用メモリ 41,932 KB
最終ジャッジ日時 2024-10-11 19:11:09
合計ジャッジ時間 5,784 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
 

public class Main {
	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> a = new HashSet<>();
		Set<Integer> b = new HashSet<>();
		for(int i=0;i<N;i++){
			a.add(sc.nextInt());
			b.add(sc.nextInt());
		}
		System.out.println(a.size()*H+b.size()*W-a.size()*b.size()-N);
		
	}
}	
0