結果
問題 | No.11 カードマッチ |
ユーザー | chiho_miyako |
提出日時 | 2015-04-16 13:48:38 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 742 bytes |
コンパイル時間 | 2,294 ms |
コンパイル使用メモリ | 72,584 KB |
実行使用メモリ | 57,688 KB |
最終ジャッジ日時 | 2023-09-17 20:49:21 |
合計ジャッジ時間 | 6,310 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
56,252 KB |
testcase_01 | AC | 120 ms
56,020 KB |
testcase_02 | AC | 122 ms
56,068 KB |
testcase_03 | AC | 122 ms
56,308 KB |
testcase_04 | WA | - |
testcase_05 | AC | 121 ms
55,768 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); int w = koko.nextInt(); int h = koko.nextInt(); int n = koko.nextInt(); int[] s = new int[n]; int[] k = new int[n]; for(int i=0; i<n; i++){ s[i]=koko.nextInt(); k[i]=koko.nextInt(); } Arrays.sort(s); Arrays.sort(k); int counts=1; int countk=1; for(int i=1; i<n; i++){ if(s[i]!=s[i-1]){ counts++; }else if(k[i]!=k[i-1]){ countk++; } } long ans=countk*w-n+counts*(h-countk); System.out.println(ans); } }