Submission #1099101


Source Code Expand

Copy
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||exec({Z=>?5*8},'ruby',$0);def f(i,c)(h=(H[i].map{|e|f e,i}.max||0)+1)>=K&&c!=1&&(h=0;$r+=1);h end;N,K,Q,*A=`dd`.split.map &:to_i;H=Hash.new{|h,k|h[k]=[]};2.upto(N){|i|H[A[i-$r=2]]<<i};f(1,1);p$r--~Q/Q

Submission Info

Submission Time
Task D - Teleporter
User leafmoon
Language Ruby (2.3.3)
Score 800
Code Size 236 Byte
Status
Exec Time 794 ms
Memory 231904 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt
All 800 / 800 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt, 1_29.txt, 1_30.txt, 1_31.txt, 1_32.txt, 1_33.txt, 1_34.txt, 1_35.txt, 1_36.txt, 1_37.txt, 1_38.txt, 1_39.txt, 1_40.txt, 1_41.txt, 1_42.txt, 1_43.txt, 1_44.txt, 1_45.txt, 1_46.txt, 1_47.txt, 1_48.txt, 1_49.txt, 1_50.txt, 1_51.txt, 1_52.txt, 1_53.txt, 1_54.txt
Case Name Status Exec Time Memory
0_00.txt 53 ms 4428 KB
0_01.txt 52 ms 4308 KB
0_02.txt 52 ms 4296 KB
1_00.txt 53 ms 4300 KB
1_01.txt 52 ms 4296 KB
1_02.txt 632 ms 225300 KB
1_03.txt 634 ms 225296 KB
1_04.txt 631 ms 225228 KB
1_05.txt 794 ms 231888 KB
1_06.txt 625 ms 225236 KB
1_07.txt 630 ms 225244 KB
1_08.txt 794 ms 231904 KB
1_09.txt 632 ms 225296 KB
1_10.txt 416 ms 123544 KB
1_11.txt 411 ms 123464 KB
1_12.txt 416 ms 123484 KB
1_13.txt 235 ms 22612 KB
1_14.txt 235 ms 22624 KB
1_15.txt 234 ms 22620 KB
1_16.txt 224 ms 24728 KB
1_17.txt 220 ms 24728 KB
1_18.txt 220 ms 24740 KB
1_19.txt 202 ms 19844 KB
1_20.txt 199 ms 19852 KB
1_21.txt 202 ms 19896 KB
1_22.txt 242 ms 23584 KB
1_23.txt 243 ms 24108 KB
1_24.txt 235 ms 21976 KB
1_25.txt 238 ms 24164 KB
1_26.txt 225 ms 20944 KB
1_27.txt 236 ms 24232 KB
1_28.txt 224 ms 19664 KB
1_29.txt 221 ms 19672 KB
1_30.txt 221 ms 19672 KB
1_31.txt 246 ms 22180 KB
1_32.txt 247 ms 25380 KB
1_33.txt 252 ms 24864 KB
1_34.txt 231 ms 22300 KB
1_35.txt 236 ms 22416 KB
1_36.txt 232 ms 22544 KB
1_37.txt 233 ms 22424 KB
1_38.txt 234 ms 22428 KB
1_39.txt 245 ms 26536 KB
1_40.txt 241 ms 26544 KB
1_41.txt 236 ms 23704 KB
1_42.txt 237 ms 23648 KB
1_43.txt 264 ms 32476 KB
1_44.txt 263 ms 32536 KB
1_45.txt 263 ms 32664 KB
1_46.txt 261 ms 32272 KB
1_47.txt 384 ms 78224 KB
1_48.txt 380 ms 78424 KB
1_49.txt 381 ms 79004 KB
1_50.txt 381 ms 78492 KB
1_51.txt 599 ms 194948 KB
1_52.txt 601 ms 194780 KB
1_53.txt 597 ms 194972 KB
1_54.txt 600 ms 195476 KB