Submission #1798274


Source Code Expand

N, Z, W = parse.(split(readline(STDIN)))
a = parse.(split(readline(STDIN)))
unshift!(a, W)
N += 1

dpx, dpy = Vector{Int}(N), Vector{Int}(N)

function f(isx, pos)
    if isx
        return dpx[pos] = max(abs(a[pos] - a[N]), pos < N-1 ? maximum([f(false, p) for p in pos+1:N-1]) : typemin(Int64))
    else
        return dpy[pos] = min(abs(a[pos] - a[N]), pos < N-1 ? minimum([f(true, p) for p in pos+1:N-1]) : typemax(Int64))
    end
end

ans = f(true, 1)
println(ans)

Submission Info

Submission Time
Task D - ABS
User kitayuta
Language Julia (0.5.0)
Score 0
Code Size 484 Byte
Status TLE
Exec Time 2113 ms
Memory 181040 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 4
AC × 12
TLE × 16
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All example_0, example_1, example_2, example_3, one_0, one_1, one_2, one_3, one_4, one_5, one_6, one_7, rand_0, rand_1, rand_10, rand_11, rand_12, rand_13, rand_14, rand_15, rand_2, rand_3, rand_4, rand_5, rand_6, rand_7, rand_8, rand_9
Case Name Status Exec Time Memory
example_0 AC 1151 ms 181040 KB
example_1 AC 658 ms 121664 KB
example_2 AC 650 ms 121800 KB
example_3 AC 573 ms 118944 KB
one_0 AC 572 ms 117764 KB
one_1 AC 575 ms 117760 KB
one_2 AC 575 ms 117184 KB
one_3 AC 575 ms 116984 KB
one_4 AC 575 ms 118544 KB
one_5 AC 573 ms 117280 KB
one_6 AC 575 ms 117172 KB
one_7 AC 577 ms 117232 KB
rand_0 TLE 2113 ms 159344 KB
rand_1 TLE 2112 ms 155936 KB
rand_10 TLE 2113 ms 158216 KB
rand_11 TLE 2113 ms 154636 KB
rand_12 TLE 2113 ms 159692 KB
rand_13 TLE 2113 ms 157596 KB
rand_14 TLE 2113 ms 159012 KB
rand_15 TLE 2112 ms 153152 KB
rand_2 TLE 2113 ms 161156 KB
rand_3 TLE 2113 ms 159052 KB
rand_4 TLE 2113 ms 160100 KB
rand_5 TLE 2113 ms 159896 KB
rand_6 TLE 2113 ms 160664 KB
rand_7 TLE 2111 ms 157368 KB
rand_8 TLE 2113 ms 159772 KB
rand_9 TLE 2113 ms 157828 KB