結果
問題 | No.11 カードマッチ |
ユーザー | くわい |
提出日時 | 2015-11-07 00:23:44 |
言語 | Scala(Beta) (3.4.0) |
結果 |
AC
|
実行時間 | 948 ms / 5,000 ms |
コード長 | 705 bytes |
コンパイル時間 | 14,623 ms |
コンパイル使用メモリ | 243,108 KB |
実行使用メモリ | 63,264 KB |
最終ジャッジ日時 | 2023-09-02 03:48:44 |
合計ジャッジ時間 | 34,000 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 891 ms
62,524 KB |
testcase_01 | AC | 898 ms
62,756 KB |
testcase_02 | AC | 898 ms
62,868 KB |
testcase_03 | AC | 899 ms
62,772 KB |
testcase_04 | AC | 911 ms
63,004 KB |
testcase_05 | AC | 877 ms
62,556 KB |
testcase_06 | AC | 906 ms
62,944 KB |
testcase_07 | AC | 924 ms
63,020 KB |
testcase_08 | AC | 907 ms
63,264 KB |
testcase_09 | AC | 948 ms
63,040 KB |
testcase_10 | AC | 920 ms
62,796 KB |
testcase_11 | AC | 912 ms
62,900 KB |
testcase_12 | AC | 904 ms
63,176 KB |
testcase_13 | AC | 910 ms
62,888 KB |
testcase_14 | AC | 933 ms
62,820 KB |
testcase_15 | AC | 928 ms
62,948 KB |
testcase_16 | AC | 908 ms
62,944 KB |
testcase_17 | AC | 910 ms
63,104 KB |
testcase_18 | AC | 908 ms
63,008 KB |
ソースコード
import java.util.Scanner object Problem011 { def proc(markKinds: Int, suitKinds: Int, handNum: Int, hand: Seq[(Int, Int)]): Long = { val handMarkNum = hand.map(x => x._1).distinct.size val handSuitNum = hand.map(x => x._2).distinct.size val matchCount: Long = handMarkNum * suitKinds + handSuitNum * markKinds val doubleCount: Long = handMarkNum * handSuitNum matchCount - doubleCount - handNum } def main(args: Array[String]) = { val sc = new Scanner(System.in) val w = sc.nextInt() val h = sc.nextInt() val n = sc.nextInt() val sk: Seq[(Int, Int)] = Seq.fill(n)(sc.nextInt(), sc.nextInt()) val result = proc(w, h, n, sk) println(result) } }