結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
rutilicus
|
| 提出日時 | 2020-12-17 18:51:31 |
| 言語 | Kotlin (2.1.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 825 bytes |
| コンパイル時間 | 12,643 ms |
| コンパイル使用メモリ | 434,620 KB |
| 実行使用メモリ | 65,336 KB |
| 最終ジャッジ日時 | 2024-09-21 08:12:23 |
| 合計ジャッジ時間 | 16,573 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 5 WA * 1 MLE * 2 |
コンパイルメッセージ
Main.kt:27:17: warning: 'appendln(String?): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator.
builder.appendln(if (ok && !lastWhite && gCnt == 0) "possible" else "impossible")
^
ソースコード
fun main() {
val builder = StringBuilder()
val t = readInputLine().toInt()
repeat(t) {
var ok = true
var gCnt = 0
var lastWhite = false
readInputLine().forEach {
when(it) {
'G' -> {
gCnt++
lastWhite = false
}
'R' -> {
if (gCnt <= 0) {
ok = false
} else {
gCnt--
}
lastWhite = false
}
else -> lastWhite = true
}
}
builder.appendln(if (ok && !lastWhite && gCnt == 0) "possible" else "impossible")
}
print(builder.toString())
}
fun readInputLine(): String {
return readLine()!!
}
rutilicus