結果

問題 No.1722 [Cherry 3rd Tune C] In my way
ユーザー 👑 箱
提出日時 2021-10-29 21:27:26
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 378 ms / 2,000 ms
コード長 1,117 bytes
コンパイル時間 14,050 ms
コンパイル使用メモリ 438,028 KB
実行使用メモリ 54,288 KB
最終ジャッジ日時 2024-04-16 14:04:27
合計ジャッジ時間 23,298 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 317 ms
53,420 KB
testcase_01 AC 328 ms
53,536 KB
testcase_02 AC 353 ms
53,852 KB
testcase_03 AC 359 ms
53,872 KB
testcase_04 AC 351 ms
53,784 KB
testcase_05 AC 337 ms
53,680 KB
testcase_06 AC 324 ms
53,520 KB
testcase_07 AC 335 ms
53,620 KB
testcase_08 AC 355 ms
54,040 KB
testcase_09 AC 336 ms
53,544 KB
testcase_10 AC 319 ms
53,460 KB
testcase_11 AC 358 ms
53,860 KB
testcase_12 AC 363 ms
53,948 KB
testcase_13 AC 373 ms
54,288 KB
testcase_14 AC 360 ms
53,860 KB
testcase_15 AC 360 ms
53,948 KB
testcase_16 AC 378 ms
54,164 KB
testcase_17 AC 367 ms
53,900 KB
testcase_18 AC 358 ms
53,972 KB
testcase_19 AC 356 ms
53,928 KB
testcase_20 AC 375 ms
54,196 KB
testcase_21 AC 308 ms
53,620 KB
testcase_22 AC 312 ms
53,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val m = nextInt()
    val x = Array(n) { nextInt() }
    val y = Array(m) { nextInt() }
    y.sort()
    loop@ for (i in 0 until n) {
        for (j in 0 until m) {
            if (x[i] < y[j]) {
                println(y[j] - x[i])
                continue@loop
            }
        }
        println("Infinity")
    }
}

fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

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()
// endregion
0