結果

問題 No.1280 Beyond C
ユーザー rutilicusrutilicus
提出日時 2020-11-07 21:21:19
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 955 ms / 2,000 ms
コード長 677 bytes
コンパイル時間 16,033 ms
コンパイル使用メモリ 423,144 KB
実行使用メモリ 75,944 KB
最終ジャッジ日時 2023-09-29 20:53:56
合計ジャッジ時間 24,233 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 287 ms
56,988 KB
testcase_01 AC 283 ms
57,128 KB
testcase_02 AC 281 ms
52,960 KB
testcase_03 AC 269 ms
53,064 KB
testcase_04 AC 286 ms
56,992 KB
testcase_05 AC 296 ms
57,276 KB
testcase_06 AC 298 ms
56,872 KB
testcase_07 AC 300 ms
56,940 KB
testcase_08 AC 302 ms
56,860 KB
testcase_09 AC 294 ms
57,036 KB
testcase_10 AC 294 ms
57,184 KB
testcase_11 AC 328 ms
57,368 KB
testcase_12 AC 302 ms
57,064 KB
testcase_13 AC 327 ms
57,560 KB
testcase_14 AC 327 ms
57,224 KB
testcase_15 AC 726 ms
66,268 KB
testcase_16 AC 675 ms
66,600 KB
testcase_17 AC 708 ms
66,640 KB
testcase_18 AC 735 ms
73,160 KB
testcase_19 AC 764 ms
73,236 KB
testcase_20 AC 955 ms
75,944 KB
testcase_21 AC 921 ms
75,628 KB
testcase_22 AC 928 ms
75,648 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:17:13: warning: 'appendln(Double): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
    builder.appendln(cnt.toDouble() / (n * m).toDouble())
            ^

ソースコード

diff #

import java.util.*

fun main() {
    val builder = StringBuilder()

    val (n, m, c) = readInputLine().split(" ").map { it.toLong() }

    val aList = readInputLine().split(" ").map { it.toLong() }
    val bList = readInputLine().split(" ").map { it.toLong() }.sorted()

    var cnt = 0L

    for (a in aList) {
        cnt += m - upperBound(bList, c / a).toLong()
    }

    builder.appendln(cnt.toDouble() / (n * m).toDouble())

    print(builder.toString())
}

fun readInputLine(): String {
    return readLine()!!
}

fun <T: Comparable<T>> upperBound(list: List<T>, value: T): Int {
    return Collections.binarySearch(list, value, {x, y -> if (x > y) 1 else -1}).inv()
}
0