Submission #1677209


Source Code Expand

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

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

mat = Array.new(M).map{Array.new(N, 0)}

A.each_with_index do |a, idx|
  mat[idx][a-1] = 1
  idx += 1
end

# for i in 0...M
#   for j in 0...N
#     printf "#{mat[i][j]} "
#   end
#   puts ""
# end

def show_bottom_col(mat, col, row = 0)
  while row < M
    #puts "s:row = #{row}, col = #{col}"
    if mat[row][col] == 1
      col += 1
      row += 1
    elsif mat[row][col-1] == 1
      col -= 1
      row += 1
    else
      row += 1
    end
    #puts "e:row = #{row}, col = #{col}"
  end
  col
end

for col in 0...N
  puts show_bottom_col(mat, col, row = 0) + 1
end

Submission Info

Submission Time
Task D - 阿弥陀
User hiroyuking
Language Ruby (2.3.3)
Score 0
Code Size 735 Byte
Status RE
Exec Time 4298 ms
Memory 1339320 KB

Compile Error

./Main.rb:39: warning: assigned but unused variable - row

Judge Result

Set Name Subtask1 Subtask2 Subtask3 Subtask4
Score / Max Score 0 / 10 0 / 20 0 / 20 0 / 50
Status
AC × 4
TLE × 5
AC × 2
WA × 11
TLE × 3
RE × 2
AC × 9
WA × 9
AC × 1
WA × 2
TLE × 26
Set Name Test Cases
Subtask1 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 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 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 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
Case Name Status Exec Time Memory
01_i.txt TLE 4295 ms 1326688 KB
01_random01.txt AC 10 ms 1916 KB
01_random02.txt AC 7 ms 1788 KB
01_random03.txt AC 7 ms 1788 KB
01_random04.txt TLE 4229 ms 237180 KB
01_random05.txt TLE 4292 ms 1293456 KB
01_random06.txt TLE 4290 ms 1258344 KB
01_random07.txt TLE 4295 ms 1325920 KB
02_i.txt AC 333 ms 17532 KB
02_p.txt WA 155 ms 8956 KB
02_random01.txt RE 9 ms 1788 KB
02_random02.txt WA 7 ms 1788 KB
02_random03.txt WA 538 ms 27260 KB
02_random04.txt RE 7 ms 1788 KB
02_random05.txt WA 3522 ms 159964 KB
02_random06.txt TLE 4267 ms 793196 KB
02_random07.txt TLE 4285 ms 1099360 KB
02_random08.txt TLE 4286 ms 1096288 KB
02_rp01.txt WA 171 ms 9596 KB
02_rp02.txt WA 168 ms 9596 KB
02_rp03.txt WA 169 ms 9596 KB
02_rp04.txt WA 169 ms 9596 KB
02_rp05.txt WA 167 ms 9468 KB
03_i.txt AC 7 ms 1788 KB
03_random01.txt AC 23 ms 3708 KB
03_random02.txt AC 184 ms 25084 KB
03_random03.txt AC 139 ms 14364 KB
03_random04.txt AC 156 ms 14252 KB
03_random05.txt AC 49 ms 6268 KB
03_random06.txt WA 47 ms 6140 KB
03_random07.txt AC 72 ms 6936 KB
03_random08.txt WA 12 ms 2044 KB
03_random09.txt WA 112 ms 12284 KB
03_random10.txt WA 201 ms 18940 KB
03_random11.txt WA 371 ms 38396 KB
03_random12.txt WA 387 ms 39676 KB
03_random13.txt AC 287 ms 23548 KB
03_random14.txt WA 234 ms 21756 KB
03_random15.txt WA 94 ms 10392 KB
04_i.txt TLE 4296 ms 1325920 KB
04_p1.txt TLE 4294 ms 1286000 KB
04_p2.txt TLE 4295 ms 1325072 KB
04_random01.txt TLE 4293 ms 1290832 KB
04_random02.txt TLE 4293 ms 1293996 KB
04_random03.txt TLE 4292 ms 1255760 KB
04_random04.txt TLE 4292 ms 1239096 KB
04_random05.txt TLE 4292 ms 1264336 KB
04_random06.txt TLE 4296 ms 1326044 KB
04_random07.txt TLE 4294 ms 1333004 KB
04_random08.txt TLE 4296 ms 1330028 KB
04_random09.txt TLE 4296 ms 1308000 KB
04_random10.txt TLE 4297 ms 1339320 KB
04_random11.txt TLE 4294 ms 1327996 KB
04_random12.txt TLE 4298 ms 1325920 KB
04_random13.txt TLE 4296 ms 1326688 KB
04_rp01.txt TLE 4293 ms 1290476 KB
04_rp02.txt TLE 4293 ms 1293164 KB
04_rp03.txt TLE 4295 ms 1284356 KB
04_rp04.txt TLE 4298 ms 1292268 KB
04_rp05.txt TLE 4294 ms 1291628 KB
04_rp06.txt TLE 4295 ms 1291628 KB
04_rp07.txt TLE 4296 ms 1287916 KB
04_rp08.txt TLE 4295 ms 1291652 KB
04_rp09.txt TLE 4298 ms 1291628 KB
04_rp10.txt TLE 4294 ms 1292396 KB
sample_1.txt AC 7 ms 1788 KB
sample_2.txt WA 7 ms 1788 KB
sample_3.txt WA 7 ms 1788 KB