結果

問題 No.11 カードマッチ
ユーザー nCk_cvnCk_cv
提出日時 2016-02-06 21:00:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 1,855 ms
コンパイル使用メモリ 74,528 KB
実行使用メモリ 64,036 KB
最終ジャッジ日時 2023-10-21 19:32:50
合計ジャッジ時間 5,349 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
57,160 KB
testcase_01 WA -
testcase_02 AC 121 ms
57,484 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 125 ms
57,420 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

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