結果

問題 No.11 カードマッチ
ユーザー nCk_cvnCk_cv
提出日時 2016-07-01 21:04:05
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 77,316 KB
実行使用メモリ 60,276 KB
最終ジャッジ日時 2024-04-20 05:06:24
合計ジャッジ時間 5,025 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
54,168 KB
testcase_01 AC 103 ms
53,004 KB
testcase_02 AC 104 ms
55,040 KB
testcase_03 WA -
testcase_04 AC 125 ms
56,016 KB
testcase_05 AC 114 ms
54,076 KB
testcase_06 WA -
testcase_07 AC 130 ms
55,808 KB
testcase_08 WA -
testcase_09 AC 142 ms
60,276 KB
testcase_10 AC 138 ms
58,928 KB
testcase_11 AC 137 ms
58,416 KB
testcase_12 AC 144 ms
59,152 KB
testcase_13 AC 138 ms
58,976 KB
testcase_14 AC 141 ms
59,004 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.math.*;
import java.util.*;


public class Main {
	static int[] vy = {1,0,-1,0};
	static int[] vx = {0,1,0,-1};
	public static void main(String[] args) {	
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int W = sc.nextInt();
		int H = sc.nextInt();
		int N = sc.nextInt();
		int[] S = new int[N];
		int[] K = new int[N];
		for(int i = 0; i < N; i++) {
			S[i] = sc.nextInt();
			K[i] = sc.nextInt();
		}
		int[] s = new int[W+1];
		int[] k = new int[H+1];
		for(int i = 0; i < N; i++) {
			s[S[i]]++;
			k[K[i]]++;
		}
		long sum = 0;
		int uniq = 0;
		for(int i = 0; i <= W; i++) {
			if(s[i] != 0) {
				sum += H;
				sum--;
				uniq++;
			}
			
		}
		for(int i = 0; i <= H; i++) {
			if(k[i] != 0) {
				sum += W - uniq;
				if(k[i] != 1)
				sum--;
			}
		}
		System.out.println(sum);
		
		
	}
}
0