Submission #34231


Source Code Expand

Copy
  inp=STDIN.readlines
inp=inp.map(&:to_i)
box=inp[1,inp[0]]
bl=box.size
def d(boxs,remain,bl)
  if remain.size==0 
    if p(boxs.flatten).size==bl
      return boxs.size
    end
  return 100  inp=STDIN.readlines
end
inp=inp.map(&:to_i)
box=inp[1,inp[0]]
bl=box.size
def d(boxs,remain,bl)
  if remain.size==0 
    if boxs.flatten.size==bl
      return boxs.size
    end
  return 100
  end

  ret=100
  t=remain.shift()
  boxs.each_with_index{|n,i|
    if n[-1]>=t
      boxs[i]<<t
      c=d(boxs,remain,bl)
      ret=c if ret>c
      boxs[i].pop()
    end
  }
      boxs<<[t]
      c=d(boxs,remain,bl)
      ret=c if ret>c
      boxs.pop()
  return ret
end
  end

  ret=100
  t=remain.shift()
  boxs.each_with_index{|n,i|
    if n[-1]>=t
      boxs[i]<<t
      c=d(boxs,remain,bl)
      ret=c if ret>c
      boxs[i].pop()
    end
  }
      boxs<<[t]
      c=d(boxs,remain,bl)
      ret=c if ret>c
      boxs.pop()
  return ret
end

puts d([],box,bl)

Submission Info

Submission Time
Task A - 宝くじ
User wass80
Language Ruby (1.9.3)
Score 0
Code Size 1007 Byte
Status RE
Exec Time 275 ms
Memory 4232 KB

Compile Error

./Main.rb:10: syntax error, unexpected tIDENTIFIER, expecting keyword_end
  return 100  inp=STDIN.readlines
                 ^
./Main.rb:11: warning: mismatched indentations at 'end' with 'if' at 6
./Main.rb:39: warning: mismatched indentations at 'end' with 'def' at 5
./Main.rb:56: syntax error, unexpected keyword_end, expecting $end

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
RE × 51
Set Name Test Cases
All 00_1_01.txt, 00_1_02.txt, 00_2_01.txt, 00_2_02.txt, 00_3_01.txt, 00_3_02.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 00_sample_05.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 01_rand_10.txt, 01_rand_11.txt, 01_rand_12.txt, 01_rand_13.txt, 01_rand_14.txt, 01_rand_15.txt, 01_rand_16.txt, 01_rand_17.txt, 01_rand_18.txt, 01_rand_19.txt, 01_rand_20.txt, 01_rand_21.txt, 01_rand_22.txt, 01_rand_23.txt, 01_rand_24.txt, 01_rand_25.txt, 01_rand_26.txt, 01_rand_27.txt, 01_rand_28.txt, 01_rand_29.txt, 01_rand_30.txt, 01_rand_31.txt, 01_rand_32.txt, 01_rand_33.txt, 01_rand_34.txt, 01_rand_35.txt, 01_rand_36.txt, 01_rand_37.txt, 01_rand_38.txt, 01_rand_39.txt
Case Name Status Exec Time Memory
00_1_01.txt RE 64 ms 4112 KB
00_1_02.txt RE 58 ms 4104 KB
00_2_01.txt RE 58 ms 4104 KB
00_2_02.txt RE 62 ms 4108 KB
00_3_01.txt RE 57 ms 4104 KB
00_3_02.txt RE 72 ms 4112 KB
00_sample_01.txt RE 64 ms 4108 KB
00_sample_02.txt RE 63 ms 4108 KB
00_sample_03.txt RE 62 ms 4108 KB
00_sample_04.txt RE 59 ms 4112 KB
00_sample_05.txt RE 61 ms 4104 KB
01_rand_00.txt RE 68 ms 4108 KB
01_rand_01.txt RE 72 ms 4136 KB
01_rand_02.txt RE 80 ms 4108 KB
01_rand_03.txt RE 66 ms 4108 KB
01_rand_04.txt RE 59 ms 4112 KB
01_rand_05.txt RE 57 ms 4108 KB
01_rand_06.txt RE 58 ms 4108 KB
01_rand_07.txt RE 67 ms 4092 KB
01_rand_08.txt RE 58 ms 4116 KB
01_rand_09.txt RE 91 ms 4104 KB
01_rand_10.txt RE 57 ms 4124 KB
01_rand_11.txt RE 57 ms 4140 KB
01_rand_12.txt RE 57 ms 4212 KB
01_rand_13.txt RE 58 ms 4104 KB
01_rand_14.txt RE 57 ms 4108 KB
01_rand_15.txt RE 58 ms 4108 KB
01_rand_16.txt RE 56 ms 4108 KB
01_rand_17.txt RE 64 ms 4088 KB
01_rand_18.txt RE 58 ms 4104 KB
01_rand_19.txt RE 64 ms 4112 KB
01_rand_20.txt RE 275 ms 4096 KB
01_rand_21.txt RE 57 ms 4140 KB
01_rand_22.txt RE 58 ms 4140 KB
01_rand_23.txt RE 57 ms 4232 KB
01_rand_24.txt RE 56 ms 4084 KB
01_rand_25.txt RE 56 ms 4104 KB
01_rand_26.txt RE 64 ms 4232 KB
01_rand_27.txt RE 65 ms 4132 KB
01_rand_28.txt RE 61 ms 4104 KB
01_rand_29.txt RE 61 ms 4112 KB
01_rand_30.txt RE 66 ms 4108 KB
01_rand_31.txt RE 62 ms 4204 KB
01_rand_32.txt RE 64 ms 4136 KB
01_rand_33.txt RE 59 ms 4108 KB
01_rand_34.txt RE 66 ms 4104 KB
01_rand_35.txt RE 62 ms 4108 KB
01_rand_36.txt RE 58 ms 4108 KB
01_rand_37.txt RE 68 ms 4108 KB
01_rand_38.txt RE 61 ms 4108 KB
01_rand_39.txt RE 60 ms 4112 KB