結果
問題 | No.11 カードマッチ |
ユーザー | chiho_miyako |
提出日時 | 2015-04-16 17:44:29 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 136 ms / 5,000 ms |
コード長 | 783 bytes |
コンパイル時間 | 1,889 ms |
コンパイル使用メモリ | 75,008 KB |
実行使用メモリ | 54,660 KB |
最終ジャッジ日時 | 2024-04-20 01:00:22 |
合計ジャッジ時間 | 5,054 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 114 ms
54,284 KB |
testcase_01 | AC | 110 ms
53,224 KB |
testcase_02 | AC | 104 ms
53,064 KB |
testcase_03 | AC | 112 ms
54,044 KB |
testcase_04 | AC | 127 ms
54,080 KB |
testcase_05 | AC | 122 ms
53,076 KB |
testcase_06 | AC | 132 ms
54,588 KB |
testcase_07 | AC | 132 ms
54,480 KB |
testcase_08 | AC | 136 ms
54,444 KB |
testcase_09 | AC | 133 ms
54,524 KB |
testcase_10 | AC | 129 ms
54,596 KB |
testcase_11 | AC | 126 ms
54,484 KB |
testcase_12 | AC | 129 ms
54,268 KB |
testcase_13 | AC | 131 ms
54,656 KB |
testcase_14 | AC | 132 ms
54,660 KB |
testcase_15 | AC | 133 ms
54,436 KB |
testcase_16 | AC | 135 ms
54,468 KB |
testcase_17 | AC | 133 ms
54,392 KB |
testcase_18 | AC | 136 ms
54,340 KB |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); long w = koko.nextLong(); long h = koko.nextLong(); 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); long counts=1; long countk=1; for(int i=1; i<n; i++){ if(s[i]!=s[i-1]){ counts++; }if(k[i]!=k[i-1]){ countk++; } } long a = countk*w; long b = h-countk; long ans=(a-n)+(counts*b); System.out.println(ans); } }