結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
💕💖💞
|
| 提出日時 | 2017-09-09 01:03:34 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 575 bytes |
| コンパイル時間 | 12,504 ms |
| コンパイル使用メモリ | 436,572 KB |
| 実行使用メモリ | 60,436 KB |
| 最終ジャッジ日時 | 2024-11-20 11:53:41 |
| 合計ジャッジ時間 | 17,683 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 3 |
コンパイルメッセージ
Main.kt:1:11: warning: parameter 'args' is never used
fun main( args : Array<String> ) {
^
Main.kt:12:16: warning: name shadowed: h
val (type, h) = x
^
ソースコード
fun main( args : Array<String> ) {
val (h, n) = readLine()!!.split(" ").map { it.toInt() }
val ns = (1..n-1).map {
readLine()!!.toInt()
}.map {
Pair("Other", it)
}.toMutableList()
ns.add( Pair("Target", h) )
ns.sortedBy{
it.second * -1
}.mapIndexed { i,x ->
val (type, h) = x
Triple(type, i+1, h)
}.filter {
it.first == "Target"
}.let {
val rank = it.first().second
when {
rank == 1 -> println("1st")
rank == 2 -> println("2nd")
rank == 3 -> println("3rd")
else -> println("${rank}th")
}
}
}
💕💖💞