結果

問題 No.1715 Dinner 2
ユーザー noetherian_ringnoetherian_ring
提出日時 2021-10-22 22:05:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,155 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 75,388 KB
最終ジャッジ日時 2023-10-24 13:15:35
合計ジャッジ時間 3,173 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,564 KB
testcase_01 AC 35 ms
53,564 KB
testcase_02 AC 35 ms
53,564 KB
testcase_03 AC 36 ms
53,564 KB
testcase_04 AC 36 ms
53,564 KB
testcase_05 AC 36 ms
53,564 KB
testcase_06 AC 35 ms
53,564 KB
testcase_07 AC 35 ms
53,564 KB
testcase_08 AC 35 ms
53,564 KB
testcase_09 AC 35 ms
53,564 KB
testcase_10 WA -
testcase_11 AC 78 ms
75,372 KB
testcase_12 AC 82 ms
75,380 KB
testcase_13 AC 87 ms
75,380 KB
testcase_14 AC 77 ms
75,376 KB
testcase_15 AC 82 ms
75,384 KB
testcase_16 AC 75 ms
75,368 KB
testcase_17 AC 70 ms
75,368 KB
testcase_18 AC 36 ms
53,564 KB
testcase_19 AC 34 ms
53,564 KB
testcase_20 AC 34 ms
53,564 KB
testcase_21 AC 34 ms
53,564 KB
testcase_22 AC 34 ms
53,564 KB
testcase_23 AC 34 ms
53,564 KB
testcase_24 AC 34 ms
53,564 KB
testcase_25 AC 47 ms
63,780 KB
testcase_26 AC 46 ms
63,756 KB
testcase_27 AC 46 ms
63,780 KB
testcase_28 AC 45 ms
63,764 KB
testcase_29 AC 47 ms
63,784 KB
testcase_30 AC 44 ms
63,756 KB
testcase_31 AC 45 ms
63,772 KB
testcase_32 AC 85 ms
75,388 KB
testcase_33 AC 87 ms
75,388 KB
testcase_34 AC 92 ms
75,388 KB
testcase_35 AC 90 ms
75,388 KB
testcase_36 AC 36 ms
53,564 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 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