Submission #8889737
Source Code Expand
#!/usr/bin/env python3 #ARC85 D import sys import math from bisect import bisect_right as br from bisect import bisect_left as bl sys.setrecursionlimit(1000000) from heapq import heappush, heappop,heappushpop from collections import defaultdict from itertools import accumulate from collections import Counter from collections import deque from operator import itemgetter from itertools import permutations mod = 10**9 + 7 inf = float('inf') def I(): return int(sys.stdin.readline()) def LI(): return list(map(int,sys.stdin.readline().split())) """ 山札がなくなると終了かつ必ず1枚は引かなくてはいけない ⇒最後の1枚は必ずどちらかの手になる(山札が1枚の場合、必ず自分の手になる) 先攻はそれを自分の手にするか、相手の手にするかを選べる 自分の手にする場合、1ターン目で全部の手札を取る 相手の手にする場合、1ターン目で最後から2番目まで全部取る この2通りのみを考える """ n,z,w = LI() a = LI() if n == 1: ans = abs(a[0] - w) else: ans = max(abs(a[-2]-a[-1]),abs(a[-1]-w)) print(ans)
Submission Info
Submission Time | |
---|---|
Task | D - ABS |
User | nrkt |
Language | PyPy3 (2.4.0) |
Score | 500 |
Code Size | 1163 Byte |
Status | AC |
Exec Time | 179 ms |
Memory | 38640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 167 ms | 38256 KB |
example_1 | AC | 170 ms | 38384 KB |
example_2 | AC | 167 ms | 38256 KB |
example_3 | AC | 164 ms | 38256 KB |
one_0 | AC | 166 ms | 38256 KB |
one_1 | AC | 168 ms | 38256 KB |
one_2 | AC | 167 ms | 38256 KB |
one_3 | AC | 168 ms | 38256 KB |
one_4 | AC | 163 ms | 38256 KB |
one_5 | AC | 171 ms | 38384 KB |
one_6 | AC | 166 ms | 38256 KB |
one_7 | AC | 168 ms | 38384 KB |
rand_0 | AC | 169 ms | 38640 KB |
rand_1 | AC | 169 ms | 38256 KB |
rand_10 | AC | 171 ms | 38640 KB |
rand_11 | AC | 170 ms | 38256 KB |
rand_12 | AC | 171 ms | 38640 KB |
rand_13 | AC | 173 ms | 38640 KB |
rand_14 | AC | 169 ms | 38640 KB |
rand_15 | AC | 175 ms | 38256 KB |
rand_2 | AC | 169 ms | 38640 KB |
rand_3 | AC | 170 ms | 38640 KB |
rand_4 | AC | 178 ms | 38640 KB |
rand_5 | AC | 179 ms | 38640 KB |
rand_6 | AC | 176 ms | 38640 KB |
rand_7 | AC | 166 ms | 38640 KB |
rand_8 | AC | 170 ms | 38640 KB |
rand_9 | AC | 165 ms | 38640 KB |