結果

問題 No.1715 Dinner 2
ユーザー noetherian_ringnoetherian_ring
提出日時 2021-10-22 21:57:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,316 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 75,244 KB
最終ジャッジ日時 2023-10-24 13:03:32
合計ジャッジ時間 3,240 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,424 KB
testcase_01 AC 39 ms
53,424 KB
testcase_02 AC 38 ms
53,424 KB
testcase_03 AC 37 ms
53,424 KB
testcase_04 AC 36 ms
53,424 KB
testcase_05 AC 36 ms
53,424 KB
testcase_06 AC 35 ms
53,424 KB
testcase_07 AC 35 ms
53,424 KB
testcase_08 AC 36 ms
53,424 KB
testcase_09 AC 35 ms
53,424 KB
testcase_10 WA -
testcase_11 AC 83 ms
75,220 KB
testcase_12 AC 83 ms
75,236 KB
testcase_13 AC 87 ms
75,228 KB
testcase_14 AC 79 ms
75,232 KB
testcase_15 AC 83 ms
75,236 KB
testcase_16 AC 74 ms
75,224 KB
testcase_17 AC 70 ms
75,224 KB
testcase_18 AC 36 ms
53,424 KB
testcase_19 AC 36 ms
53,424 KB
testcase_20 AC 37 ms
53,424 KB
testcase_21 AC 35 ms
53,424 KB
testcase_22 AC 36 ms
53,424 KB
testcase_23 AC 35 ms
53,424 KB
testcase_24 AC 35 ms
53,424 KB
testcase_25 AC 50 ms
63,640 KB
testcase_26 AC 49 ms
63,616 KB
testcase_27 AC 51 ms
63,640 KB
testcase_28 AC 49 ms
63,624 KB
testcase_29 AC 51 ms
63,644 KB
testcase_30 AC 47 ms
63,616 KB
testcase_31 AC 49 ms
63,632 KB
testcase_32 AC 90 ms
75,240 KB
testcase_33 AC 92 ms
75,244 KB
testcase_34 AC 94 ms
75,244 KB
testcase_35 AC 91 ms
75,240 KB
testcase_36 AC 37 ms
53,424 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import os

sys.setrecursionlimit(100000)
is_local = "TERM_PROGRAM" in os.environ
input = sys.stdin.readline
INF = float('inf')
MOD = 998244353

def debug(*args, **kwargs):
    if is_local:
        print(*args, **kwargs)
def I(): return input().rstrip()
def IS(): return input().split()
def II(): return int(input())
def IIS(): return map(int, input().split())
def LIIS(): return list(map(int, input().split()))

def main():
    n, d = IIS()
    loss = []
    gain = []
    for _ in range(n):
        p, q = IIS()
        loss.append(p)
        gain.append(q)

    m = -INF
    am = None
    amp = None
    for i in range(n):
        for j in range(n):
            if i == j:
                continue
            p0 = -loss[i]
            p1 = -loss[i] + gain[i] - loss[j]
            dx = -loss[i] + gain[i] -loss[j] + gain[j]
            if dx < 0:
                p0 = p0 + ((d+1)//2 - 1) * dx
                p1 = p1 + (d//2 - 1) * dx
                # if d % 2 == 0:
                #     p1 = p1 + (d//2 - 1) * dx
                # else:
                #     p1 = p1 + max(0, (d//2 - 2)) * dx

            if min(p0, p1) > m:
                m = min(p0, p1)
                amp = (p0, p1)
                am = (i, j)
    print(m)
    debug(am)
    debug(amp)


if __name__ == "__main__":
    main()
0