AtCoder Beginner Contest 013

Submission #1679314

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

if D != 1
  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 }
else
  to.each{ |t| puts t }
end

Submission

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

Test case

Set

Set name Score得点 / Max score Cases
Subtask1 10 / 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 AC 211 ms 23932 KB
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 15 ms 2556 KB
01_random05.txt AC 106 ms 6780 KB
01_random06.txt AC 177 ms 20728 KB
01_random07.txt AC 211 ms 23932 KB
02_i.txt AC 120 ms 10364 KB
02_p.txt AC 113 ms 9596 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 43 ms 6268 KB
02_random06.txt AC 64 ms 12412 KB
02_random07.txt AC 232 ms 29564 KB
02_random08.txt AC 237 ms 29564 KB
02_rp01.txt AC 70 ms 6908 KB
02_rp02.txt AC 64 ms 6524 KB
02_rp03.txt AC 23 ms 3452 KB
02_rp04.txt AC 65 ms 6524 KB
02_rp05.txt AC 68 ms 6780 KB
03_i.txt AC 40 ms 1916 KB
03_random01.txt AC 17 ms 3196 KB
03_random02.txt AC 113 ms 20092 KB
03_random03.txt AC 94 ms 18044 KB
03_random04.txt AC 93 ms 17788 KB
03_random05.txt AC 25 ms 4476 KB
03_random06.txt AC 22 ms 4348 KB
03_random07.txt AC 31 ms 4860 KB
03_random08.txt AC 9 ms 1916 KB
03_random09.txt AC 42 ms 7164 KB
03_random10.txt AC 67 ms 11388 KB
03_random11.txt AC 120 ms 20476 KB
03_random12.txt AC 159 ms 22012 KB
03_random13.txt AC 103 ms 17660 KB
03_random14.txt AC 105 ms 12412 KB
03_random15.txt AC 58 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 7 ms 1788 KB
sample_3.txt AC 7 ms 1788 KB