結果

問題 No.11 カードマッチ
ユーザー k_kadorak_kadora
提出日時 2015-06-15 15:49:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 608 bytes
コンパイル時間 3,482 ms
コンパイル使用メモリ 74,432 KB
実行使用メモリ 49,276 KB
最終ジャッジ日時 2024-04-20 01:02:59
合計ジャッジ時間 7,071 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,132 KB
testcase_01 AC 121 ms
40,100 KB
testcase_02 AC 133 ms
41,204 KB
testcase_03 AC 113 ms
41,332 KB
testcase_04 AC 155 ms
47,796 KB
testcase_05 AC 136 ms
41,448 KB
testcase_06 AC 159 ms
49,268 KB
testcase_07 AC 156 ms
44,320 KB
testcase_08 AC 158 ms
45,908 KB
testcase_09 AC 157 ms
49,276 KB
testcase_10 AC 142 ms
48,196 KB
testcase_11 AC 154 ms
47,112 KB
testcase_12 AC 142 ms
47,252 KB
testcase_13 AC 160 ms
46,848 KB
testcase_14 AC 157 ms
46,224 KB
testcase_15 AC 151 ms
41,892 KB
testcase_16 AC 140 ms
41,660 KB
testcase_17 AC 137 ms
41,624 KB
testcase_18 AC 147 ms
41,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
	}
}
		
0