結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
19,552 KB
testcase_01 AC 90 ms
15,364 KB
testcase_02 AC 87 ms
15,544 KB
testcase_03 AC 93 ms
15,440 KB
testcase_04 AC 91 ms
15,412 KB
testcase_05 AC 91 ms
15,456 KB
testcase_06 AC 92 ms
15,372 KB
testcase_07 AC 94 ms
15,416 KB
testcase_08 AC 93 ms
15,584 KB
testcase_09 AC 309 ms
36,132 KB
testcase_10 AC 311 ms
35,996 KB
testcase_11 AC 312 ms
36,052 KB
testcase_12 AC 962 ms
35,384 KB
testcase_13 AC 1,390 ms
35,148 KB
testcase_14 AC 978 ms
35,184 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 = small(index,n-1)
  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