結果

問題 No.1715 Dinner 2
ユーザー HydruHydru
提出日時 2021-10-22 22:56:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 767 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 72,484 KB
最終ジャッジ日時 2023-10-24 14:23:09
合計ジャッジ時間 3,459 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,468 KB
testcase_01 AC 35 ms
53,468 KB
testcase_02 AC 35 ms
53,468 KB
testcase_03 AC 34 ms
53,468 KB
testcase_04 AC 34 ms
53,468 KB
testcase_05 WA -
testcase_06 AC 34 ms
53,468 KB
testcase_07 AC 34 ms
53,468 KB
testcase_08 AC 34 ms
53,468 KB
testcase_09 AC 34 ms
53,468 KB
testcase_10 AC 34 ms
53,468 KB
testcase_11 AC 83 ms
70,344 KB
testcase_12 AC 89 ms
70,412 KB
testcase_13 AC 91 ms
68,340 KB
testcase_14 AC 87 ms
70,412 KB
testcase_15 AC 90 ms
70,400 KB
testcase_16 AC 79 ms
68,300 KB
testcase_17 AC 72 ms
68,304 KB
testcase_18 AC 35 ms
53,468 KB
testcase_19 AC 34 ms
53,468 KB
testcase_20 AC 33 ms
53,468 KB
testcase_21 AC 34 ms
53,468 KB
testcase_22 AC 33 ms
53,468 KB
testcase_23 AC 34 ms
53,468 KB
testcase_24 AC 33 ms
53,468 KB
testcase_25 AC 49 ms
63,864 KB
testcase_26 AC 49 ms
63,844 KB
testcase_27 AC 50 ms
63,864 KB
testcase_28 AC 48 ms
63,864 KB
testcase_29 AC 49 ms
63,864 KB
testcase_30 AC 47 ms
63,856 KB
testcase_31 AC 49 ms
63,860 KB
testcase_32 AC 100 ms
72,476 KB
testcase_33 AC 101 ms
72,484 KB
testcase_34 AC 99 ms
72,484 KB
testcase_35 AC 94 ms
70,400 KB
testcase_36 WA -
testcase_37 AC 34 ms
53,468 KB
testcase_38 AC 33 ms
53,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,d=map(int,input().split())
food=[]
for _ in range(n):
    p,q=map(int,input().split())
    food.append([-p,q,q-p])
food.sort()
las=food[-1][0]
ans=-10**9+1
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        T=food[i][2]+food[j][2]
        tmp=min(food[i][0],food[i][2]+food[j][0])
        if T<0:
            if tmp==food[i][0]:
                if d%2==0:
                    tmp=T*(d//2-1)+min(food[i][0],food[i][2]+las)
                else:
                    tmp=T*((d-1)//2)+min(-food[j][1],las)
            else:
                if d%2==0:
                    tmp=T*(d//2-1)+min(food[i][0],food[i][2]+las)
                else:
                    tmp=T*((d-1)//2)+min(las,-food[j][1])
        ans=max(ans,tmp)
print(ans)
0