結果

問題 No.1715 Dinner 2
ユーザー mkawa2mkawa2
提出日時 2021-10-22 21:43:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,173 bytes
コンパイル時間 1,249 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 74,664 KB
最終ジャッジ日時 2023-10-24 12:44:56
合計ジャッジ時間 3,637 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,468 KB
testcase_01 AC 38 ms
53,468 KB
testcase_02 AC 36 ms
53,468 KB
testcase_03 AC 36 ms
53,468 KB
testcase_04 AC 36 ms
53,468 KB
testcase_05 AC 37 ms
53,468 KB
testcase_06 AC 36 ms
53,468 KB
testcase_07 AC 37 ms
53,468 KB
testcase_08 AC 37 ms
53,468 KB
testcase_09 AC 37 ms
53,468 KB
testcase_10 WA -
testcase_11 AC 84 ms
70,708 KB
testcase_12 AC 97 ms
73,324 KB
testcase_13 AC 106 ms
74,664 KB
testcase_14 AC 96 ms
74,084 KB
testcase_15 AC 100 ms
73,064 KB
testcase_16 AC 79 ms
70,720 KB
testcase_17 AC 70 ms
70,580 KB
testcase_18 AC 37 ms
53,468 KB
testcase_19 AC 37 ms
53,468 KB
testcase_20 AC 37 ms
53,468 KB
testcase_21 AC 37 ms
53,468 KB
testcase_22 AC 37 ms
53,468 KB
testcase_23 AC 37 ms
53,468 KB
testcase_24 AC 37 ms
53,468 KB
testcase_25 AC 56 ms
66,148 KB
testcase_26 AC 58 ms
68,128 KB
testcase_27 AC 56 ms
66,132 KB
testcase_28 AC 58 ms
66,148 KB
testcase_29 AC 56 ms
66,132 KB
testcase_30 AC 55 ms
66,132 KB
testcase_31 AC 63 ms
70,284 KB
testcase_32 AC 98 ms
72,784 KB
testcase_33 AC 100 ms
72,768 KB
testcase_34 AC 98 ms
72,768 KB
testcase_35 AC 95 ms
72,768 KB
testcase_36 AC 38 ms
53,468 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sre_constants
import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**19
# md = 998244353
md = 10**9+7

def solve(i, j):
    p1, q1 = pq[i]
    p2, q2 = pq[j]
    res = min(-p1+q1-p2, -p1)
    if d & 1:
        a = (-p1+q1-p2+q2)*(d//2)-p1
        res = min(res, a)
        a += p1-q2
        res = min(res, a)
    else:
        a = (-p1+q1-p2+q2)*(d//2)-q2
        res = min(res, a)
        a += p2-q1
        res = min(res, a)
    return res

n, d = LI()
pq = LLI(n)

ans = -inf
for i in range(n):
    for j in range(n):
        if i == j: continue
        ans = max(ans, solve(i, j))

print(ans)
0