Submission #17933561


Source Code Expand

Copy
(W,),(N,K),*AB = $<.map{|ln| ln.split.map(&:to_i) }
= Array.new(K+1){ [0]*(W+1) }
AB.each{|a,b|
next if W < a
.each_cons(2).reverse_each{|k,k1|
k[0,W-a+1].each.with_index(a){|d,w|
k1[w] = d+b if k1[w] < d+b
}
}
}
p [-1][-1]
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(W,),(N,K),*AB = $<.map{|ln| ln.split.map(&:to_i) }

重要度 = Array.new(K+1){ [0]*(W+1) }
AB.each{|a,b|
	next if W < a
	重要度.each_cons(2).reverse_each{|k,k1|
		k[0,W-a+1].each.with_index(a){|d,w|
			k1[w] = d+b if k1[w] < d+b
		}
	}
}

p 重要度[-1][-1]

Submission Info

Submission Time
Task D - 高橋くんの苦悩
User ds14050
Language Ruby (2.7.1)
Score 0
Code Size 277 Byte
Status TLE
Exec Time 2088 ms
Memory 89704 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 40
TLE × 7
Set Name Test Cases
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt
Case Name Status Exec Time Memory
sample_01.txt AC 59 ms 14100 KB
sample_02.txt AC 57 ms 14524 KB
sample_03.txt AC 61 ms 14212 KB
test_01.txt TLE 2088 ms 83840 KB
test_02.txt AC 95 ms 14484 KB
test_03.txt AC 62 ms 14488 KB
test_04.txt AC 63 ms 14596 KB
test_05.txt AC 62 ms 14364 KB
test_06.txt AC 62 ms 14304 KB
test_07.txt AC 96 ms 17108 KB
test_08.txt AC 61 ms 14524 KB
test_09.txt AC 75 ms 15400 KB
test_10.txt AC 105 ms 18356 KB
test_11.txt AC 89 ms 16392 KB
test_12.txt AC 67 ms 14816 KB
test_13.txt AC 67 ms 14736 KB
test_14.txt AC 65 ms 14584 KB
test_15.txt TLE 2081 ms 83856 KB
test_16.txt AC 69 ms 14832 KB
test_17.txt TLE 2037 ms 84032 KB
test_18.txt AC 1566 ms 82952 KB
test_19.txt AC 66 ms 14672 KB
test_20.txt AC 1527 ms 83944 KB
test_21.txt AC 492 ms 34752 KB
test_22.txt AC 62 ms 14416 KB
test_23.txt AC 464 ms 32320 KB
test_24.txt TLE 2054 ms 87968 KB
test_25.txt AC 66 ms 14604 KB
test_26.txt TLE 2021 ms 83924 KB
test_27.txt AC 82 ms 16084 KB
test_28.txt AC 56 ms 14384 KB
test_29.txt AC 79 ms 15732 KB
test_30.txt AC 897 ms 51484 KB
test_31.txt AC 58 ms 14356 KB
test_32.txt AC 869 ms 49560 KB
test_33.txt TLE 2055 ms 89704 KB
test_34.txt AC 70 ms 14600 KB
test_35.txt TLE 2012 ms 84356 KB
test_36.txt AC 1645 ms 81000 KB
test_37.txt AC 65 ms 14560 KB
test_38.txt AC 1681 ms 81144 KB
test_39.txt AC 1257 ms 73160 KB
test_40.txt AC 63 ms 14496 KB
test_41.txt AC 1209 ms 68720 KB


2025-04-21 (Mon)
12:05:39 +00:00