結果

問題 No.1021 Children in Classrooms
ユーザー zazaboonzazaboon
提出日時 2020-04-10 22:08:37
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 1,156 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 11,308 KB
実行使用メモリ 36,252 KB
最終ジャッジ日時 2023-10-14 00:44:52
合計ジャッジ時間 10,475 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
15,364 KB
testcase_01 AC 94 ms
15,156 KB
testcase_02 AC 93 ms
15,380 KB
testcase_03 AC 94 ms
15,420 KB
testcase_04 AC 93 ms
15,312 KB
testcase_05 AC 93 ms
15,424 KB
testcase_06 AC 93 ms
15,540 KB
testcase_07 AC 94 ms
15,464 KB
testcase_08 AC 94 ms
15,344 KB
testcase_09 AC 307 ms
36,252 KB
testcase_10 AC 307 ms
36,188 KB
testcase_11 AC 310 ms
36,096 KB
testcase_12 AC 934 ms
35,412 KB
testcase_13 AC 1,367 ms
35,348 KB
testcase_14 AC 952 ms
35,188 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:4: warning: assigned but unused variable - a
Main.rb:6: warning: assigned but unused variable - a
Main.rb:18: warning: assigned but unused variable - a
Main.rb:28: warning: assigned but unused variable - k
Syntax OK

ソースコード

diff #

#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

n , k = inp
a = inp
s = gets.chomp
index = 0
s.each_char do |c|
  index = [index,n-1].min
  if c == "L"
    if(index == 0)
      next if a.size == 1
      d = a.shift
      a[0] += d
    else
      index  -= 1
    end
  else
    index += 1
    next if a.size == 1
    if(index > (n-a.size))
      d = a.pop
      a[-1] += d
    end
  end
 #p  index = [index,n-1].min
end
index = [index,n-1].min
index.times do
  a.unshift(0)
end
(n- a.size).times do
  a.push(0)
end
puts a.join(" ")
0