Submission #35895537


Source Code Expand

(N,A),*F = $<.map{|ln| ln.split.map(&:to_i) }
F.sort_by!{_2}
p F.map.with_index{|(w0,x0,v0),i|
	wi = Hash.new 0
	wo = Hash.new 0 
	F[i+1..].each{|w,x,v|
		dx = x-x0
		dv = v-v0
		if 0<=dv
			if dx<=A
				wi[0] += w
				if 0<dv
					t = (A-dx).fdiv dv
					wo[t] += w
				end
			end
		else
			dv = -dv
			t = [(dx-A).fdiv(dv),0].max
			wi[t] += w
			t = (A+dx).fdiv dv
			wo[t] += w
		end
	}
	w = w0
	next (wi.keys|wo.keys).sort.map{|t|
		_ = w += wi[t]
		w -= wo[t]
		next _
	}.max||w
}.max

Submission Info

Submission Time
Task F - Fishing
User ds14050
Language Ruby (2.7.1)
Score 0
Code Size 522 Byte
Status WA
Exec Time 1586 ms
Memory 59832 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 15
WA × 8
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 72 ms 14052 KiB
random_02.txt WA 250 ms 30780 KiB
random_03.txt WA 1586 ms 59796 KiB
random_04.txt WA 301 ms 33424 KiB
random_05.txt AC 1339 ms 57748 KiB
random_06.txt AC 100 ms 17888 KiB
random_07.txt WA 1465 ms 59528 KiB
random_08.txt WA 737 ms 44884 KiB
random_09.txt AC 1411 ms 59020 KiB
random_10.txt AC 83 ms 16416 KiB
random_11.txt WA 1481 ms 59832 KiB
random_12.txt WA 79 ms 16728 KiB
random_13.txt AC 1427 ms 58456 KiB
random_14.txt AC 436 ms 36560 KiB
random_15.txt WA 1580 ms 56412 KiB
random_16.txt AC 60 ms 14172 KiB
random_17.txt AC 868 ms 22116 KiB
random_18.txt AC 985 ms 19160 KiB
random_19.txt AC 855 ms 21108 KiB
random_20.txt AC 800 ms 17472 KiB
sample_01.txt AC 54 ms 14156 KiB
sample_02.txt AC 58 ms 14096 KiB
sample_03.txt AC 57 ms 14228 KiB