結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
22,156 KB
testcase_01 AC 88 ms
15,196 KB
testcase_02 AC 91 ms
15,340 KB
testcase_03 AC 95 ms
15,392 KB
testcase_04 AC 94 ms
15,276 KB
testcase_05 AC 93 ms
15,368 KB
testcase_06 AC 90 ms
15,280 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 304 ms
36,068 KB
testcase_10 AC 297 ms
36,100 KB
testcase_11 AC 300 ms
35,992 KB
testcase_12 AC 938 ms
35,280 KB
testcase_13 AC 1,351 ms
35,252 KB
testcase_14 AC 929 ms
35,256 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|
  break if a.size == 1
  if c == "L"
    if(index == 0)
      d = a.shift
      a[0] += d
    else
      index  -= 1
    end
  else
    index += 1
    if(index > (n-a.size))
      d = a.pop
      a[-1] += d
      index = [index,n-1].min
    end
  end
end
index.times do
  a.unshift(0)
end
(n- a.size).times do
  a.push(0)
end
puts a.join(" ")
0