結果

問題 No.1395 Less Sweet Alchemy
コンテスト
ユーザー 箱星
提出日時 2021-02-14 21:27:13
言語 Kotlin
(2.3.20)
コンパイル:
kotlinc _filename_ -include-runtime -d main.jar
実行:
kotlin main.jar
結果
AC  
実行時間 271 ms / 2,000 ms
コード長 683 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 14,770 ms
コンパイル使用メモリ 466,392 KB
実行使用メモリ 59,608 KB
最終ジャッジ日時 2026-04-03 08:19:05
合計ジャッジ時間 16,893 ms
ジャッジサーバーID
(参考情報)
judge5_1 / judge4_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:8:29: warning: unnecessary non-null assertion (!!) on a non-null receiver of type 'Int'.
    println(if (x in c.min()!!..c.max()!!) "Yes" else "No")
                            ^^
Main.kt:8:40: warning: unnecessary non-null assertion (!!) on a non-null receiver of type 'Int'.
    println(if (x in c.min()!!..c.max()!!) "Yes" else "No")
                                       ^^

ソースコード

diff #
raw source code

import java.io.PrintWriter
import java.util.*

fun PrintWriter.solve() {
    val n = nextInt()
    val x = nextInt()
    val c = Array(n) { nextInt() }
    println(if (x in c.min()!!..c.max()!!) "Yes" else "No")
}

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

// 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