結果
問題 | No.1021 Children in Classrooms |
ユーザー | da_louis |
提出日時 | 2020-04-10 23:14:27 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 840 ms / 2,000 ms |
コード長 | 1,012 bytes |
コンパイル時間 | 18,342 ms |
コンパイル使用メモリ | 421,660 KB |
実行使用メモリ | 80,524 KB |
最終ジャッジ日時 | 2023-10-14 04:47:42 |
合計ジャッジ時間 | 33,473 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 312 ms
56,656 KB |
testcase_01 | AC | 314 ms
57,096 KB |
testcase_02 | AC | 313 ms
56,772 KB |
testcase_03 | AC | 351 ms
57,284 KB |
testcase_04 | AC | 355 ms
57,020 KB |
testcase_05 | AC | 358 ms
57,016 KB |
testcase_06 | AC | 357 ms
57,112 KB |
testcase_07 | AC | 368 ms
57,168 KB |
testcase_08 | AC | 362 ms
57,400 KB |
testcase_09 | AC | 816 ms
77,060 KB |
testcase_10 | AC | 823 ms
76,968 KB |
testcase_11 | AC | 824 ms
76,768 KB |
testcase_12 | AC | 834 ms
77,168 KB |
testcase_13 | AC | 824 ms
76,820 KB |
testcase_14 | AC | 834 ms
76,724 KB |
testcase_15 | AC | 782 ms
70,964 KB |
testcase_16 | AC | 781 ms
69,340 KB |
testcase_17 | AC | 800 ms
71,100 KB |
testcase_18 | AC | 840 ms
80,524 KB |
testcase_19 | AC | 440 ms
59,084 KB |
コンパイルメッセージ
Main.kt:2:10: warning: parameter 'args' is never used fun main(args: Array<String>) = p1021() ^ Main.kt:6:10: warning: variable 'n' is never used val (n, m) = readLine()!!.split(' ').map { it.toInt() } ^ Main.kt:6:13: warning: variable 'm' is never used val (n, m) = readLine()!!.split(' ').map { it.toInt() } ^
ソースコード
@ExperimentalStdlibApi fun main(args: Array<String>) = p1021() @ExperimentalStdlibApi fun p1021() { val (n, m) = readLine()!!.split(' ').map { it.toInt() } val aList = readLine()!!.split(' ').map { it.toLong() } val s = readLine()!! val queue = ArrayDeque(aList) var left = 0 var right = aList.lastIndex for (c in s) { if (c == 'R') { if (right == aList.lastIndex && queue.size >= 2) { queue.addLast(queue.removeLast() + queue.removeLast()) } left = Math.min(left + 1, aList.lastIndex) right = Math.min(right + 1, aList.lastIndex) } else { if (left == 0 && queue.size >= 2) { queue.addFirst(queue.removeFirst() + queue.removeFirst()) } left = Math.max(left - 1, 0) right = Math.max(right - 1, 0) } } val answer = (List(left) { 0 } + queue + List(aList.lastIndex - right) { 0 }).joinToString(" ") println(answer) }