Submission #51184903
Source Code Expand
$In = $<.map{|ln| ln.split.map(&:to_i) }
N, = $In.shift
P = $In.shift N
R = $In.shift N
D = $In<<[0]*N
P00 = P[0][0]
待機数残コスト = Array.new(N){[]}
待機数残コスト[0]<<[0,0]
N.times{
ps = P.pop
rs = R.pop
ds = D.pop
ac0r = []
r = 0
待機数残コスト.map!{|ac0d|
p = ps.pop
d = ds.pop
a0,c0 = -1,1.0/0
ac = (ac0d.flat_map{|a,c|
c += d
next [a,c],[a+c/p,c%p]
}+ac0r.flat_map{|a,c|
c += r
next [a,c],[a+c/p,c%p]
}).sort.select{|a,c|
a0,c0 = a,c if a0<a && c<c0
}
r = rs.pop
next ac0r = ac
}
}
p 待機数残コスト[-1].map{|a,c| a+(c+P00-1)/P00 }.min+N+N-2
Submission Info
| Submission Time | |
|---|---|
| Task | F - Earn to Advance |
| User | ds14050 |
| Language | Ruby (ruby 3.2.2) |
| Score | 0 |
| Code Size | 652 Byte |
| Status | WA |
| Exec Time | 4416 ms |
| Memory | 21688 KiB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 550 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt |
| All | min.txt, 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, random_25.txt, random_26.txt, random_27.txt, random_28.txt, sample_01.txt, sample_02.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| min.txt | AC | 123 ms | 17264 KiB |
| random_01.txt | AC | 731 ms | 20400 KiB |
| random_02.txt | AC | 397 ms | 20092 KiB |
| random_03.txt | TLE | 4415 ms | 20640 KiB |
| random_04.txt | WA | 1171 ms | 19984 KiB |
| random_05.txt | AC | 759 ms | 20464 KiB |
| random_06.txt | AC | 741 ms | 20508 KiB |
| random_07.txt | TLE | 4416 ms | 21688 KiB |
| random_08.txt | AC | 200 ms | 19496 KiB |
| random_09.txt | AC | 769 ms | 20700 KiB |
| random_10.txt | TLE | 4415 ms | 20684 KiB |
| random_11.txt | AC | 705 ms | 20392 KiB |
| random_12.txt | TLE | 4415 ms | 20516 KiB |
| random_13.txt | AC | 775 ms | 20480 KiB |
| random_14.txt | TLE | 4415 ms | 20636 KiB |
| random_15.txt | AC | 690 ms | 20628 KiB |
| random_16.txt | TLE | 4416 ms | 20668 KiB |
| random_17.txt | WA | 619 ms | 20160 KiB |
| random_18.txt | WA | 99 ms | 18256 KiB |
| random_19.txt | WA | 2789 ms | 20604 KiB |
| random_20.txt | WA | 2703 ms | 20548 KiB |
| random_21.txt | WA | 625 ms | 20312 KiB |
| random_22.txt | WA | 300 ms | 19396 KiB |
| random_23.txt | WA | 3097 ms | 20564 KiB |
| random_24.txt | WA | 2442 ms | 20452 KiB |
| random_25.txt | AC | 2371 ms | 20604 KiB |
| random_26.txt | AC | 2306 ms | 20656 KiB |
| random_27.txt | AC | 60 ms | 17964 KiB |
| random_28.txt | AC | 2240 ms | 20644 KiB |
| sample_01.txt | AC | 43 ms | 17520 KiB |
| sample_02.txt | AC | 42 ms | 17360 KiB |