Submission #869810


Source Code Expand

Copy
n,x=gets.not_nil!.split.map(&.to_i64)
a=gets.not_nil!.split.map(&.to_i64)
b=a.dup
p (0...n).map{|i|
	t=0_i64
	n.times{|j|t+=b[j]=[b[j],a[(j-i)%n]].min}
	t+x*i.to_i64
}.min

Submission Info

Submission Time
Task B - Colorful Slimes
User leafmoon
Language Crystal (0.20.5)
Score 400
Code Size 178 Byte
Status
Exec Time 1344 ms
Memory 1144 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt
All 400 / 400 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
Case Name Status Exec Time Memory
0_00.txt 5 ms 632 KB
0_01.txt 5 ms 632 KB
0_02.txt 5 ms 632 KB
1_00.txt 1336 ms 888 KB
1_01.txt 1328 ms 888 KB
1_02.txt 1294 ms 1144 KB
1_03.txt 1323 ms 1144 KB
1_04.txt 1331 ms 1144 KB
1_05.txt 1324 ms 1144 KB
1_06.txt 1344 ms 1144 KB
1_07.txt 1309 ms 1144 KB
1_08.txt 1312 ms 1144 KB
1_09.txt 1341 ms 1144 KB
1_10.txt 996 ms 1016 KB
1_11.txt 1299 ms 1144 KB
1_12.txt 1206 ms 1144 KB
1_13.txt 839 ms 1016 KB
1_14.txt 1282 ms 1144 KB
1_15.txt 1056 ms 1016 KB
1_16.txt 1193 ms 1016 KB
1_17.txt 1284 ms 1144 KB