結果

問題 No.1021 Children in Classrooms
ユーザー gemmarogemmaro
提出日時 2020-04-26 07:39:50
言語 Ruby
(3.3.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 450 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 817,408 KB
最終ジャッジ日時 2024-04-27 16:15:09
合計ジャッジ時間 5,376 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,160 KB
testcase_01 AC 79 ms
12,416 KB
testcase_02 AC 78 ms
12,160 KB
testcase_03 AC 114 ms
48,256 KB
testcase_04 AC 124 ms
54,656 KB
testcase_05 AC 123 ms
48,256 KB
testcase_06 AC 118 ms
47,488 KB
testcase_07 AC 159 ms
78,848 KB
testcase_08 AC 154 ms
75,136 KB
testcase_09 MLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# frozen_string_literal: true

# rubocop:todo Metrics/AbcSize
def solve_rec(a, s) # rubocop:todo Naming/MethodParameterName
  if s.empty?
    a.join(' ')
  elsif s[0] == 'L'
    solve_rec([a[0] + a[1]] + a[2..-1] + [0], s[1..-1])
  else # s[0] == 'R'
    solve_rec([0] + a[0..-3] + [a[-2] + a[-1]], s[1..-1])
  end
end
# rubocop:enable Metrics/AbcSize

gets
A = gets.chomp.split.map(&:to_i)
S = gets.chomp.chars

RESULT = solve_rec(A, S)

puts RESULT
0