結果
問題 | No.927 Second Permutation |
ユーザー | 💕💖💞 |
提出日時 | 2019-12-23 21:49:49 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 602 bytes |
コンパイル時間 | 15,743 ms |
コンパイル使用メモリ | 439,364 KB |
実行使用メモリ | 61,828 KB |
最終ジャッジ日時 | 2023-10-19 05:19:20 |
合計ジャッジ時間 | 32,713 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 333 ms
58,620 KB |
testcase_01 | AC | 340 ms
58,624 KB |
testcase_02 | AC | 325 ms
58,632 KB |
testcase_03 | AC | 328 ms
58,628 KB |
testcase_04 | AC | 330 ms
58,632 KB |
testcase_05 | AC | 330 ms
58,624 KB |
testcase_06 | AC | 333 ms
58,620 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 477 ms
59,100 KB |
testcase_25 | AC | 451 ms
59,076 KB |
testcase_26 | AC | 430 ms
58,948 KB |
testcase_27 | AC | 425 ms
58,944 KB |
testcase_28 | AC | 467 ms
59,064 KB |
testcase_29 | AC | 457 ms
59,072 KB |
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used fun main(args:Array<String>) { ^
ソースコード
fun main(args:Array<String>) { val a = readLine()!! val b = a.toList().sorted().reversed().map { it.toString().toInt() }.toMutableList() //println(a) //println(b) val last = b.last() var good = false for(i in b.size-1 downTo 0 step 1) { //println(b[i]) if( last != b[i]) { good = true b[b.size-1] = b[i] b[i] = last break } } if(good == false) { println(-1) } else if(b.first() == 0) { println(-1) } else { println(b.map{it.toString()}.joinToString("")) } }