結果

問題 No.11 カードマッチ
ユーザー nCk_cv
提出日時 2016-02-06 21:00:00
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 74,544 KB
実行使用メモリ 49,628 KB
最終ジャッジ日時 2024-09-21 20:54:50
合計ジャッジ時間 5,996 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
 
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();
		long sum = 0;
		int[] W = new int[w];
		int[] H = new int[h];
		int uh = 0;
		int uw = 0;
		for(int i = 0; i < n; i++) {
			int s = sc.nextInt()-1;
			int k = sc.nextInt()-1;
			if(W[s] == 0) uw++;
			if(H[k] == 0) uh++;
		}
		System.out.println((long)w * h - (w - uw) * (h - uh) - n);
		
		
		
	}	
	
}
0