Submission #35204328


Source Code Expand

N,K,*A = $<.read.split.map(&:to_i)

k,b,r = K,0
A.sort.each_with_index{|a,l|
	r = N-l
	break if k<r*(a-b)
	k -= r*(a-b)
	b = a
}
b += k/r
k %= r

puts A.map{|a|
	a = a<b ? 0 : a-b
	if 0<a && 0<k
		a -= 1
		k -= 1
	end
	next a
}*' '

Submission Info

Submission Time
Task E - Apple Baskets on Circle
User ds14050
Language Ruby (2.7.1)
Score 500
Code Size 252 Byte
Status AC
Exec Time 138 ms
Memory 25036 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 26
Set Name Test Cases
Sample sample_01.txt, sample_02.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, random_21.txt, random_22.txt, random_23.txt, random_24.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 138 ms 24748 KiB
random_02.txt AC 101 ms 21680 KiB
random_03.txt AC 136 ms 24468 KiB
random_04.txt AC 116 ms 23856 KiB
random_05.txt AC 137 ms 24556 KiB
random_06.txt AC 129 ms 24500 KiB
random_07.txt AC 135 ms 24420 KiB
random_08.txt AC 84 ms 19140 KiB
random_09.txt AC 133 ms 24572 KiB
random_10.txt AC 124 ms 24368 KiB
random_11.txt AC 132 ms 23868 KiB
random_12.txt AC 97 ms 20764 KiB
random_13.txt AC 130 ms 23836 KiB
random_14.txt AC 111 ms 22760 KiB
random_15.txt AC 130 ms 23792 KiB
random_16.txt AC 63 ms 15028 KiB
random_17.txt AC 132 ms 23756 KiB
random_18.txt AC 125 ms 23676 KiB
random_19.txt AC 123 ms 24808 KiB
random_20.txt AC 56 ms 14128 KiB
random_21.txt AC 130 ms 25036 KiB
random_22.txt AC 56 ms 14128 KiB
random_23.txt AC 110 ms 23072 KiB
random_24.txt AC 56 ms 14172 KiB
sample_01.txt AC 57 ms 14048 KiB
sample_02.txt AC 56 ms 14172 KiB