Submission #1077098


Source Code Expand

Copy
ENV[Z='RUBY_THREAD_VM_STACK_SIZE']||exec({Z=>'50000000'},'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 242 Byte
Status
Exec Time 653 ms
Memory 225316 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 52 ms 4304 KB
0_01.txt 52 ms 4296 KB
0_02.txt 53 ms 4300 KB
1_00.txt 53 ms 4300 KB
1_01.txt 53 ms 4296 KB
1_02.txt 653 ms 225312 KB
1_03.txt 647 ms 225316 KB
1_04.txt 652 ms 225236 KB
1_05.txt 643 ms 225240 KB
1_06.txt 639 ms 225292 KB
1_07.txt 644 ms 225312 KB
1_08.txt 644 ms 225232 KB
1_09.txt 644 ms 225304 KB
1_10.txt 425 ms 123536 KB
1_11.txt 425 ms 123476 KB
1_12.txt 422 ms 123484 KB
1_13.txt 237 ms 22612 KB
1_14.txt 235 ms 22664 KB
1_15.txt 236 ms 22676 KB
1_16.txt 224 ms 24736 KB
1_17.txt 222 ms 24748 KB
1_18.txt 225 ms 24740 KB
1_19.txt 203 ms 26020 KB
1_20.txt 201 ms 19912 KB
1_21.txt 203 ms 19860 KB
1_22.txt 246 ms 23720 KB
1_23.txt 245 ms 24036 KB
1_24.txt 232 ms 21988 KB
1_25.txt 241 ms 24232 KB
1_26.txt 237 ms 24236 KB
1_27.txt 238 ms 24236 KB
1_28.txt 226 ms 19612 KB
1_29.txt 222 ms 19612 KB
1_30.txt 219 ms 26168 KB
1_31.txt 247 ms 22628 KB
1_32.txt 250 ms 25120 KB
1_33.txt 234 ms 22168 KB
1_34.txt 244 ms 26016 KB
1_35.txt 244 ms 25372 KB
1_36.txt 236 ms 22492 KB
1_37.txt 235 ms 22536 KB
1_38.txt 235 ms 22420 KB
1_39.txt 245 ms 23772 KB
1_40.txt 243 ms 23580 KB
1_41.txt 239 ms 23828 KB
1_42.txt 240 ms 23696 KB
1_43.txt 268 ms 32396 KB
1_44.txt 264 ms 32540 KB
1_45.txt 265 ms 32656 KB
1_46.txt 262 ms 32352 KB
1_47.txt 389 ms 78168 KB
1_48.txt 386 ms 78484 KB
1_49.txt 386 ms 78936 KB
1_50.txt 385 ms 78424 KB
1_51.txt 612 ms 194900 KB
1_52.txt 617 ms 194900 KB
1_53.txt 618 ms 195024 KB
1_54.txt 637 ms 195548 KB