結果

問題 No.11 カードマッチ
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-05-29 01:53:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 5,000 ms
コード長 676 bytes
コンパイル時間 3,210 ms
コンパイル使用メモリ 72,256 KB
実行使用メモリ 56,348 KB
最終ジャッジ日時 2023-09-12 20:21:02
合計ジャッジ時間 7,055 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,808 KB
testcase_01 AC 125 ms
55,700 KB
testcase_02 AC 120 ms
55,740 KB
testcase_03 AC 119 ms
55,424 KB
testcase_04 AC 137 ms
55,920 KB
testcase_05 AC 121 ms
56,200 KB
testcase_06 AC 141 ms
55,652 KB
testcase_07 AC 139 ms
56,348 KB
testcase_08 AC 140 ms
56,164 KB
testcase_09 AC 139 ms
55,948 KB
testcase_10 AC 135 ms
56,112 KB
testcase_11 AC 141 ms
56,172 KB
testcase_12 AC 141 ms
56,052 KB
testcase_13 AC 140 ms
55,908 KB
testcase_14 AC 140 ms
55,904 KB
testcase_15 AC 136 ms
55,912 KB
testcase_16 AC 140 ms
55,936 KB
testcase_17 AC 138 ms
54,068 KB
testcase_18 AC 140 ms
55,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No011{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int W = sc.nextInt();
		int H = sc.nextInt();
		int N = sc.nextInt();

		ArrayList<Integer> mark_unique = new ArrayList<Integer>();
		ArrayList<Integer> num_unique = new ArrayList<Integer>();
		
		for(int i = 0; i < N; i++){
			int mark = sc.nextInt();
			if(!mark_unique.contains(mark)) mark_unique.add(mark);
			
			int num = sc.nextInt();
			if(!num_unique.contains(num)) num_unique.add(num);
		}
		
		int m_unique = mark_unique.size();
		int n_unique = num_unique.size();
		System.out.println(m_unique*H + n_unique*W - m_unique*n_unique - N);
	}
}
0