結果

問題 No.1715 Dinner 2
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2021-10-22 21:48:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 81,620 KB
実行使用メモリ 75,712 KB
最終ジャッジ日時 2023-10-24 12:52:15
合計ジャッジ時間 3,829 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,396 KB
testcase_01 AC 39 ms
53,396 KB
testcase_02 AC 38 ms
53,396 KB
testcase_03 AC 38 ms
53,396 KB
testcase_04 AC 37 ms
53,396 KB
testcase_05 AC 37 ms
53,396 KB
testcase_06 AC 37 ms
53,396 KB
testcase_07 AC 38 ms
53,396 KB
testcase_08 AC 39 ms
53,396 KB
testcase_09 AC 38 ms
53,396 KB
testcase_10 WA -
testcase_11 AC 110 ms
75,528 KB
testcase_12 AC 138 ms
75,452 KB
testcase_13 AC 136 ms
75,448 KB
testcase_14 AC 127 ms
75,452 KB
testcase_15 AC 132 ms
75,448 KB
testcase_16 AC 104 ms
75,496 KB
testcase_17 AC 93 ms
75,504 KB
testcase_18 AC 37 ms
53,396 KB
testcase_19 AC 36 ms
53,396 KB
testcase_20 AC 36 ms
53,396 KB
testcase_21 AC 37 ms
53,396 KB
testcase_22 AC 37 ms
53,396 KB
testcase_23 AC 37 ms
53,396 KB
testcase_24 AC 37 ms
53,396 KB
testcase_25 AC 55 ms
64,060 KB
testcase_26 AC 56 ms
66,100 KB
testcase_27 AC 55 ms
64,060 KB
testcase_28 AC 54 ms
64,060 KB
testcase_29 AC 54 ms
64,060 KB
testcase_30 AC 54 ms
64,060 KB
testcase_31 AC 57 ms
66,100 KB
testcase_32 AC 137 ms
75,712 KB
testcase_33 AC 134 ms
75,708 KB
testcase_34 AC 133 ms
75,692 KB
testcase_35 AC 129 ms
75,672 KB
testcase_36 AC 37 ms
53,396 KB
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d=map(int,input().split())
p=[]
q=[]
for i in range(n):
    a,b=map(int,input().split())
    p.append(a)
    q.append(b)

ans=-2**64
for i in range(n):
    for j in range(n):
        if i==j:continue
        pi,qi=p[i],q[i]
        pj,qj=p[j],q[j]
        res=0
        day=d
        res=min(-pi,-pi+qi-pj)
        go=((d-2)//2)*2
        sub=(-pi+qi-pj+qj)*(go//2)
        day-=go
        for j in range(1,day+1):
            if j%2==1:
                sub-=pi
                res=min(res,sub)
                sub+=qi
            else:
                sub -= pj
                res = min(res, sub)
                sub += qj
        ans=max(ans,res)
print(ans)

0