結果

問題 No.1715 Dinner 2
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-10-22 21:36:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 692 bytes
コンパイル時間 1,007 ms
コンパイル使用メモリ 81,388 KB
実行使用メモリ 68,188 KB
最終ジャッジ日時 2023-10-24 12:34:18
合計ジャッジ時間 3,656 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,368 KB
testcase_01 AC 38 ms
53,368 KB
testcase_02 AC 39 ms
53,368 KB
testcase_03 AC 36 ms
53,368 KB
testcase_04 AC 37 ms
53,368 KB
testcase_05 AC 38 ms
53,368 KB
testcase_06 WA -
testcase_07 AC 38 ms
53,368 KB
testcase_08 AC 38 ms
53,368 KB
testcase_09 AC 37 ms
53,368 KB
testcase_10 WA -
testcase_11 AC 74 ms
66,116 KB
testcase_12 AC 82 ms
68,180 KB
testcase_13 AC 86 ms
68,188 KB
testcase_14 AC 79 ms
68,180 KB
testcase_15 AC 85 ms
68,180 KB
testcase_16 AC 71 ms
66,116 KB
testcase_17 AC 64 ms
66,116 KB
testcase_18 AC 37 ms
53,368 KB
testcase_19 AC 38 ms
53,368 KB
testcase_20 AC 38 ms
53,368 KB
testcase_21 AC 37 ms
53,368 KB
testcase_22 AC 37 ms
53,368 KB
testcase_23 AC 37 ms
53,368 KB
testcase_24 AC 38 ms
53,368 KB
testcase_25 AC 52 ms
63,724 KB
testcase_26 AC 53 ms
63,720 KB
testcase_27 AC 53 ms
63,720 KB
testcase_28 AC 53 ms
63,724 KB
testcase_29 AC 51 ms
63,720 KB
testcase_30 AC 51 ms
63,720 KB
testcase_31 AC 54 ms
65,784 KB
testcase_32 AC 87 ms
68,172 KB
testcase_33 AC 87 ms
68,172 KB
testcase_34 AC 86 ms
66,120 KB
testcase_35 AC 83 ms
66,116 KB
testcase_36 AC 36 ms
53,368 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

同じ2種類のみを繰り返すのが最適?


"""

import sys
from sys import stdin
import math

N,D = map(int,stdin.readline().split())

PQ = []

for i in range(N):
    P,Q = map(int,stdin.readline().split())
    PQ.append((P,Q))

ans = float("-inf")

for i in range(N):
    for j in range(N):

        pi,qi = PQ[i]
        pj,qj = PQ[j]

        if i == j:
            continue

        nans = min(-1 * pi , -1*pi + qi - pj)

        last = (-pi+qi-pj+qj) * (D//2) + (-pj+qj) * (D % 2)

        if D % 2 == 0:
            nans = min(nans , last-qj , last-qj+pj-qi)
        else:
            nans = min(nans , last-qi , last-qi+pi-qj)

        ans = max(ans , nans)

print (ans)
0