結果

問題 No.1021 Children in Classrooms
ユーザー simansiman
提出日時 2020-09-04 03:19:50
言語 Ruby
(3.3.0)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 11,220 KB
実行使用メモリ 32,560 KB
最終ジャッジ日時 2023-08-16 04:20:33
合計ジャッジ時間 6,600 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,340 KB
testcase_01 AC 84 ms
15,160 KB
testcase_02 AC 81 ms
15,248 KB
testcase_03 AC 84 ms
15,280 KB
testcase_04 AC 84 ms
15,464 KB
testcase_05 AC 86 ms
15,356 KB
testcase_06 AC 86 ms
15,200 KB
testcase_07 AC 88 ms
15,192 KB
testcase_08 AC 86 ms
15,200 KB
testcase_09 AC 328 ms
32,400 KB
testcase_10 AC 324 ms
32,508 KB
testcase_11 AC 326 ms
32,512 KB
testcase_12 AC 322 ms
32,496 KB
testcase_13 AC 324 ms
32,560 KB
testcase_14 AC 324 ms
32,448 KB
testcase_15 AC 286 ms
29,896 KB
testcase_16 AC 284 ms
30,104 KB
testcase_17 AC 296 ms
30,752 KB
testcase_18 AC 314 ms
32,184 KB
testcase_19 AC 176 ms
15,732 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - idx
Main.rb:6: warning: assigned but unused variable - zure
Syntax OK

ソースコード

diff #

N, M = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)
S = gets.chomp

idx = 0
zure = 0

S.each_char do |s|
  if s == 'L'
    a1, a2 = A.shift(2)
    A.unshift(a1 + a2)
    A.push(0)
  else
    a1, a2 = A.pop(2)
    A.push(a1 + a2)
    A.unshift(0)
  end
end

puts A.join(' ')
0