結果

問題 No.1715 Dinner 2
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-10-22 21:47:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 849 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,680 KB
実行使用メモリ 76,164 KB
最終ジャッジ日時 2023-10-24 12:50:07
合計ジャッジ時間 3,943 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,524 KB
testcase_01 AC 37 ms
53,524 KB
testcase_02 AC 38 ms
53,524 KB
testcase_03 AC 37 ms
53,524 KB
testcase_04 AC 37 ms
53,524 KB
testcase_05 WA -
testcase_06 AC 37 ms
53,524 KB
testcase_07 AC 37 ms
53,524 KB
testcase_08 AC 37 ms
53,524 KB
testcase_09 AC 38 ms
53,524 KB
testcase_10 WA -
testcase_11 AC 113 ms
75,920 KB
testcase_12 AC 124 ms
76,020 KB
testcase_13 AC 123 ms
75,936 KB
testcase_14 AC 115 ms
76,048 KB
testcase_15 AC 122 ms
75,968 KB
testcase_16 AC 107 ms
75,816 KB
testcase_17 AC 100 ms
75,820 KB
testcase_18 AC 37 ms
53,524 KB
testcase_19 AC 36 ms
53,524 KB
testcase_20 AC 36 ms
53,524 KB
testcase_21 AC 37 ms
53,524 KB
testcase_22 AC 36 ms
53,524 KB
testcase_23 AC 37 ms
53,524 KB
testcase_24 AC 38 ms
53,524 KB
testcase_25 AC 66 ms
70,352 KB
testcase_26 AC 61 ms
68,296 KB
testcase_27 AC 65 ms
70,324 KB
testcase_28 AC 62 ms
68,276 KB
testcase_29 AC 55 ms
66,204 KB
testcase_30 AC 57 ms
66,204 KB
testcase_31 AC 63 ms
68,316 KB
testcase_32 AC 127 ms
75,992 KB
testcase_33 AC 115 ms
75,780 KB
testcase_34 AC 139 ms
76,164 KB
testcase_35 AC 117 ms
75,900 KB
testcase_36 AC 36 ms
53,524 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d = map(int,input().split())
PQ = [list(map(int,input().split())) for i in range(n)]

ans = -10**10
for i in range(n):
    for j in range(i):
        a,b = PQ[i]
        c,d = PQ[j]
        if a+c <= b+d:
            ans = max(ans,min(-a,-a+b-c))
            ans = max(ans,min(-c,-c+d-a))
        else:
            base = (-a-c+b+d)*(d//2-1)
            left = d-2*(d//2-1)
            cand = base
            num = base
            for _ in range(2):
                for k in range(left):
                    if k%2:
                        num -= a
                        cand = min(cand,num)
                        num += b
                    else:
                        num -= c
                        cand = min(cand,num)
                        num += d
                ans = max(ans,cand)
                a,b,c,d = c,d,a,b
print(ans)
0