結果

問題 No.1280 Beyond C
ユーザー 👑 箱
提出日時 2020-11-06 21:30:11
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 838 ms / 2,000 ms
コード長 1,208 bytes
コンパイル時間 13,658 ms
コンパイル使用メモリ 427,628 KB
実行使用メモリ 65,124 KB
最終ジャッジ日時 2023-09-29 18:14:42
合計ジャッジ時間 23,744 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
53,792 KB
testcase_01 AC 266 ms
53,684 KB
testcase_02 AC 272 ms
53,940 KB
testcase_03 AC 274 ms
53,940 KB
testcase_04 AC 271 ms
53,872 KB
testcase_05 AC 270 ms
53,704 KB
testcase_06 AC 267 ms
53,692 KB
testcase_07 AC 267 ms
54,084 KB
testcase_08 AC 264 ms
53,792 KB
testcase_09 AC 267 ms
53,788 KB
testcase_10 AC 285 ms
53,744 KB
testcase_11 AC 296 ms
53,808 KB
testcase_12 AC 273 ms
53,852 KB
testcase_13 AC 278 ms
53,952 KB
testcase_14 AC 276 ms
53,812 KB
testcase_15 AC 583 ms
61,328 KB
testcase_16 AC 558 ms
60,192 KB
testcase_17 AC 592 ms
60,304 KB
testcase_18 AC 523 ms
62,432 KB
testcase_19 AC 524 ms
62,488 KB
testcase_20 AC 838 ms
65,124 KB
testcase_21 AC 809 ms
64,880 KB
testcase_22 AC 834 ms
64,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.util.*
import kotlin.collections.ArrayList

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val m = sc.nextInt()
    val c = sc.nextLong()
    val a = Array(n) { sc.nextLong() }
    val b = Array(m) { sc.nextLong() }
    var total = 0L
    a.sort()
    b.sort()
    var j = m - 1
    for (i in 0 until n) {
        while (j > 0 && a[i] * b[j - 1] > c) j--
        if (a[i] * b[j] > c) {
            total += m - j
        }
    }
    println(total / (n.toLong() * m).toDouble())
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}
0