Submission #8884349


Source Code Expand

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n, z, w = LI()
    a = LI()
    if n == 1:
        print(abs(a[0] - w))
    else:
        print(max(abs(a[-1] - w), abs(a[-2] - a[-1])))
    return


#main
if __name__ == '__main__':
    solve()

Submission Info

Submission Time
Task D - ABS
User horiso0921
Language PyPy3 (2.4.0)
Score 500
Code Size 1164 Byte
Status AC
Exec Time 182 ms
Memory 39152 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 4
AC × 28
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 173 ms 38512 KB
example_1 AC 172 ms 38512 KB
example_2 AC 170 ms 38512 KB
example_3 AC 173 ms 38384 KB
one_0 AC 174 ms 38512 KB
one_1 AC 173 ms 38384 KB
one_2 AC 172 ms 38512 KB
one_3 AC 171 ms 38512 KB
one_4 AC 174 ms 38512 KB
one_5 AC 175 ms 38512 KB
one_6 AC 174 ms 38512 KB
one_7 AC 182 ms 38512 KB
rand_0 AC 182 ms 39152 KB
rand_1 AC 174 ms 38512 KB
rand_10 AC 176 ms 39152 KB
rand_11 AC 175 ms 38512 KB
rand_12 AC 175 ms 39152 KB
rand_13 AC 177 ms 39152 KB
rand_14 AC 176 ms 39152 KB
rand_15 AC 177 ms 38512 KB
rand_2 AC 179 ms 39152 KB
rand_3 AC 178 ms 39152 KB
rand_4 AC 179 ms 39152 KB
rand_5 AC 177 ms 39152 KB
rand_6 AC 177 ms 39152 KB
rand_7 AC 181 ms 39152 KB
rand_8 AC 178 ms 39152 KB
rand_9 AC 177 ms 39152 KB