AtCoder Beginner Contest 013

Submission #1678900

Source codeソースコード

lines = $stdin.read
array = lines.split("\n")

def fact(n, a=1)
  return a if n == 0
  fact(n-1, n*a)
end

N,M,D = array[0].split(" ").map(&:to_i)
A     = array[1].split(" ").map(&:to_i)

st    = 1.upto(N).to_a
to    = 1.upto(N).to_a

for a in A.reverse
  to[a], to[a-1] = to[a-1],to[a]
end

d = D % fact(N)

1.upto(d) do |i|
  #puts "concat! D =#{i}"
  neo_to = Array.new(N)

  to.each_with_index do |elem,idx|
    neo_to[idx] = st[elem-1]
  end
  st = neo_to
  #puts st.to_s
end

st.each{ |t| puts t }

Submission

Task問題 D - 阿弥陀
User nameユーザ名 hiroyuking
Created time投稿日時
Language言語 Ruby (2.3.3)
Status状態 RE
Score得点 20
Source lengthソースコード長 534 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Subtask1 0 / 10 sample_1.txt,01_i.txt,01_random01.txt,01_random02.txt,01_random03.txt,01_random04.txt,01_random05.txt,01_random06.txt,01_random07.txt
Subtask2 0 / 20 sample_1.txt,sample_2.txt,sample_3.txt,02_i.txt,02_p.txt,02_random01.txt,02_random02.txt,02_random03.txt,02_random04.txt,02_random05.txt,02_random06.txt,02_random07.txt,02_random08.txt,02_rp01.txt,02_rp02.txt,02_rp03.txt,02_rp04.txt,02_rp05.txt
Subtask3 20 / 20 sample_1.txt,sample_2.txt,03_i.txt,03_random01.txt,03_random02.txt,03_random03.txt,03_random04.txt,03_random05.txt,03_random06.txt,03_random07.txt,03_random08.txt,03_random09.txt,03_random10.txt,03_random11.txt,03_random12.txt,03_random13.txt,03_random14.txt,03_random15.txt
Subtask4 0 / 50 sample_1.txt,sample_2.txt,sample_3.txt,04_i.txt,04_p1.txt,04_p2.txt,04_random01.txt,04_random02.txt,04_random03.txt,04_random04.txt,04_random05.txt,04_random06.txt,04_random07.txt,04_random08.txt,04_random09.txt,04_random10.txt,04_random11.txt,04_random12.txt,04_random13.txt,04_rp01.txt,04_rp02.txt,04_rp03.txt,04_rp04.txt,04_rp05.txt,04_rp06.txt,04_rp07.txt,04_rp08.txt,04_rp09.txt,04_rp10.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01_i.txt RE
01_random01.txt AC 7 ms 1788 KB
01_random02.txt AC 7 ms 1788 KB
01_random03.txt AC 7 ms 1788 KB
01_random04.txt AC 23 ms 8700 KB
01_random05.txt RE
01_random06.txt RE
01_random07.txt RE
02_i.txt AC 122 ms 10108 KB
02_p.txt AC 116 ms 9724 KB
02_random01.txt RE
02_random02.txt AC 7 ms 1788 KB
02_random03.txt AC 19 ms 3196 KB
02_random04.txt RE
02_random05.txt AC 45 ms 6268 KB
02_random06.txt AC 67 ms 12412 KB
02_random07.txt AC 238 ms 29564 KB
02_random08.txt AC 239 ms 29564 KB
02_rp01.txt AC 72 ms 6908 KB
02_rp02.txt AC 66 ms 6524 KB
02_rp03.txt AC 24 ms 3452 KB
02_rp04.txt AC 67 ms 6524 KB
02_rp05.txt AC 70 ms 6780 KB
03_i.txt AC 41 ms 1916 KB
03_random01.txt AC 18 ms 3196 KB
03_random02.txt AC 119 ms 20092 KB
03_random03.txt AC 98 ms 17916 KB
03_random04.txt AC 97 ms 17788 KB
03_random05.txt AC 26 ms 4476 KB
03_random06.txt AC 23 ms 4348 KB
03_random07.txt AC 32 ms 4860 KB
03_random08.txt AC 10 ms 1916 KB
03_random09.txt AC 44 ms 7164 KB
03_random10.txt AC 69 ms 11388 KB
03_random11.txt AC 123 ms 20476 KB
03_random12.txt AC 164 ms 22012 KB
03_random13.txt AC 107 ms 17660 KB
03_random14.txt AC 108 ms 12412 KB
03_random15.txt AC 59 ms 5784 KB
04_i.txt RE
04_p1.txt RE
04_p2.txt RE
04_random01.txt RE
04_random02.txt RE
04_random03.txt RE
04_random04.txt TLE
04_random05.txt RE
04_random06.txt RE
04_random07.txt RE
04_random08.txt RE
04_random09.txt RE
04_random10.txt RE
04_random11.txt RE
04_random12.txt RE
04_random13.txt RE
04_rp01.txt RE
04_rp02.txt RE
04_rp03.txt RE
04_rp04.txt RE
04_rp05.txt RE
04_rp06.txt RE
04_rp07.txt RE
04_rp08.txt RE
04_rp09.txt RE
04_rp10.txt RE
sample_1.txt AC 7 ms 1788 KB
sample_2.txt AC 8 ms 1788 KB
sample_3.txt AC 8 ms 1788 KB