結果
問題 | No.927 Second Permutation |
ユーザー | 💕💖💞 |
提出日時 | 2019-12-23 21:47:48 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 566 bytes |
コンパイル時間 | 16,737 ms |
コンパイル使用メモリ | 437,772 KB |
実行使用メモリ | 61,216 KB |
最終ジャッジ日時 | 2023-10-19 05:12:41 |
合計ジャッジ時間 | 36,199 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 341 ms
58,620 KB |
testcase_02 | AC | 341 ms
58,620 KB |
testcase_03 | AC | 344 ms
58,608 KB |
testcase_04 | AC | 341 ms
58,612 KB |
testcase_05 | AC | 342 ms
58,612 KB |
testcase_06 | AC | 339 ms
58,608 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 | 494 ms
59,016 KB |
testcase_25 | AC | 473 ms
58,996 KB |
testcase_26 | AC | 459 ms
58,928 KB |
testcase_27 | AC | 441 ms
58,920 KB |
testcase_28 | AC | 483 ms
59,020 KB |
testcase_29 | AC | 464 ms
58,984 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) } }