Submission #1008943
Source Code Expand
Copy
n,x = gets.split.map &:to_ia = gets.split.map &:to_is = 0i = 0while i != n-1y = a[i]+a[i+1]-xif y > 0if a[i+1] >= ya[i+1] -= yelsea[i] = a[i] - (y-a[i+1])a[i+1] = 0ends += yendi += 1endp s
n,x = gets.split.map &:to_i a = gets.split.map &:to_i s = 0 i = 0 while i != n-1 y = a[i]+a[i+1]-x if y > 0 if a[i+1] >= y a[i+1] -= y else a[i] = a[i] - (y-a[i+1]) a[i+1] = 0 end s += y end i += 1 end p s
Submission Info
Submission Time | |
---|---|
Task | C - Boxes and Candies |
User | oda1979 |
Language | Ruby (2.3.3) |
Score | 300 |
Code Size | 308 Byte |
Status | AC |
Exec Time | 83 ms |
Memory | 8580 KB |
Compile Error
./Main.rb:1: warning: `&' interpreted as argument prefix ./Main.rb:2: warning: `&' interpreted as argument prefix
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 10 ms | 1788 KB |
0_01.txt | AC | 10 ms | 1788 KB |
0_02.txt | AC | 10 ms | 1788 KB |
0_03.txt | AC | 10 ms | 1788 KB |
1_00.txt | AC | 10 ms | 1788 KB |
1_01.txt | AC | 10 ms | 1788 KB |
1_02.txt | AC | 10 ms | 1788 KB |
1_03.txt | AC | 10 ms | 1788 KB |
1_04.txt | AC | 53 ms | 7676 KB |
1_05.txt | AC | 53 ms | 7676 KB |
1_06.txt | AC | 81 ms | 8580 KB |
1_07.txt | AC | 78 ms | 8580 KB |
1_08.txt | AC | 81 ms | 8452 KB |
1_09.txt | AC | 81 ms | 8452 KB |
1_10.txt | AC | 81 ms | 8324 KB |
1_11.txt | AC | 75 ms | 8324 KB |
1_12.txt | AC | 81 ms | 8196 KB |
1_13.txt | AC | 83 ms | 8452 KB |
1_14.txt | AC | 80 ms | 8452 KB |
1_15.txt | AC | 79 ms | 8452 KB |