結果
| 問題 | No.11 カードマッチ | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2015-06-15 15:49:41 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 157 ms / 5,000 ms | 
| コード長 | 608 bytes | 
| コンパイル時間 | 3,271 ms | 
| コンパイル使用メモリ | 74,788 KB | 
| 実行使用メモリ | 49,228 KB | 
| 最終ジャッジ日時 | 2024-10-11 19:49:51 | 
| 合計ジャッジ時間 | 6,852 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 19 | 
ソースコード
import java.util.Scanner;
public class Yuki11{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		long tempw=0,temph=0,res;
		int w,h,n,temps,tempk;
		w = sc.nextInt();
		h = sc.nextInt();
		n = sc.nextInt();
		int[] cs = new int[w];
		int[] ck = new int[h];
		for(int i = 0;i<n;i++){
			temps = sc.nextInt()-1;
			tempk = sc.nextInt()-1;
			if(cs[temps] == 0){
				cs[temps] = 1;
				tempw++;
			}
			if(ck[tempk] == 0){
				ck[tempk] = 1;
				temph++;
			}
		}
		res = (long)h*(long)tempw+(long)w*(long)temph-(long)tempw*(long)temph-(long)n;
		System.out.println(res);
	}
}
		
            
            
            
        