結果

問題 No.1373 Directed Operations
ユーザー 👑 箱
提出日時 2021-02-05 21:30:17
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 784 bytes
コンパイル時間 12,643 ms
コンパイル使用メモリ 423,984 KB
実行使用メモリ 62,368 KB
最終ジャッジ日時 2023-09-15 07:14:28
合計ジャッジ時間 25,316 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 279 ms
53,512 KB
testcase_02 WA -
testcase_03 AC 437 ms
57,260 KB
testcase_04 AC 446 ms
59,256 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 568 ms
60,032 KB
testcase_10 AC 546 ms
58,436 KB
testcase_11 AC 442 ms
57,408 KB
testcase_12 AC 558 ms
58,104 KB
testcase_13 AC 379 ms
56,932 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fun PrintWriter.solve() {
    val n = nextInt()
    val a = Array(n - 1) { nextInt() }
    a.sort()
    for (i in 0 until n - 1) {
        if (a[i] !in 1..1 + i) {
            println("NO")
            return
        }
    }
    println("YES")
}

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