結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
54,032 KB
testcase_01 WA -
testcase_02 AC 106 ms
53,264 KB
testcase_03 AC 102 ms
53,288 KB
testcase_04 AC 136 ms
56,000 KB
testcase_05 AC 100 ms
52,824 KB
testcase_06 AC 141 ms
60,696 KB
testcase_07 AC 125 ms
58,028 KB
testcase_08 WA -
testcase_09 AC 134 ms
59,900 KB
testcase_10 AC 135 ms
58,908 KB
testcase_11 AC 139 ms
59,000 KB
testcase_12 AC 134 ms
59,028 KB
testcase_13 AC 139 ms
59,208 KB
testcase_14 AC 137 ms
58,744 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;
			}
		}
		System.out.println(sum);
		
		
	}
}
0