結果

問題 No.11 カードマッチ
ユーザー doyazaki012doyazaki012
提出日時 2015-05-28 22:11:44
言語 Java19
(openjdk 21)
結果
AC  
実行時間 139 ms / 5,000 ms
コード長 812 bytes
コンパイル時間 2,401 ms
コンパイル使用メモリ 71,756 KB
実行使用メモリ 58,248 KB
最終ジャッジ日時 2023-08-02 00:07:06
合計ジャッジ時間 6,012 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
57,596 KB
testcase_01 AC 119 ms
58,036 KB
testcase_02 AC 121 ms
58,068 KB
testcase_03 AC 118 ms
57,900 KB
testcase_04 AC 129 ms
58,104 KB
testcase_05 AC 117 ms
58,180 KB
testcase_06 AC 137 ms
58,060 KB
testcase_07 AC 132 ms
57,932 KB
testcase_08 AC 131 ms
57,612 KB
testcase_09 AC 135 ms
57,688 KB
testcase_10 AC 135 ms
57,896 KB
testcase_11 AC 139 ms
58,012 KB
testcase_12 AC 134 ms
58,204 KB
testcase_13 AC 133 ms
57,688 KB
testcase_14 AC 133 ms
58,248 KB
testcase_15 AC 138 ms
57,924 KB
testcase_16 AC 138 ms
57,932 KB
testcase_17 AC 138 ms
58,000 KB
testcase_18 AC 137 ms
57,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Yuki11{
	public static final int  MAX_DATA = 1000000;
	public static boolean[] mark = new boolean[MAX_DATA+1];
	public static boolean[] number = new boolean[MAX_DATA+1];

	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int w = stdIn.nextInt();
		int h = stdIn.nextInt();
		int n = stdIn.nextInt();
		int countStype = 0;
		int countKtype = 0;

		for(int i=0;i<n;i++){
			int s = stdIn.nextInt();
			int k = stdIn.nextInt();
			if(mark[s]==false){
				countStype++;
				mark[s]=true;
			}
			if(number[k]==false){
				countKtype++;
				number[k]=true;
			}
		}
		//System.out.println(w+" "+h+" "+n+" "+countStype+" "+countKtype);
		int answer = (h*countStype) + (w*countKtype) - (countStype*countKtype) - n;
		System.out.println(answer);


	}
}
0