結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
40,308 KB
testcase_01 AC 115 ms
40,916 KB
testcase_02 AC 117 ms
40,120 KB
testcase_03 AC 111 ms
41,240 KB
testcase_04 AC 133 ms
44,012 KB
testcase_05 AC 116 ms
40,168 KB
testcase_06 WA -
testcase_07 AC 131 ms
44,656 KB
testcase_08 WA -
testcase_09 AC 145 ms
49,384 KB
testcase_10 AC 137 ms
48,436 KB
testcase_11 AC 137 ms
46,908 KB
testcase_12 AC 142 ms
47,568 KB
testcase_13 AC 134 ms
47,060 KB
testcase_14 AC 140 ms
46,452 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 += W;
				sum--;
				uniq++;
			}
			
		}
		for(int i = 0; i <= H; i++) {
			if(k[i] != 0) {
				sum += H - uniq;
				if(k[i] != 1)
				sum--;
			}
		}
		System.out.println(sum);
		
		
	}
}
0