結果

問題 No.1715 Dinner 2
ユーザー HydruHydru
提出日時 2021-10-22 22:50:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 714 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 70,408 KB
最終ジャッジ日時 2023-10-24 14:15:02
合計ジャッジ時間 3,777 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
53,436 KB
testcase_01 AC 42 ms
53,436 KB
testcase_02 WA -
testcase_03 AC 39 ms
53,436 KB
testcase_04 AC 39 ms
53,436 KB
testcase_05 WA -
testcase_06 AC 38 ms
53,436 KB
testcase_07 AC 39 ms
53,436 KB
testcase_08 AC 38 ms
53,436 KB
testcase_09 AC 39 ms
53,436 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 93 ms
70,388 KB
testcase_13 AC 96 ms
68,324 KB
testcase_14 AC 90 ms
68,340 KB
testcase_15 AC 92 ms
68,328 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 39 ms
53,436 KB
testcase_19 AC 38 ms
53,436 KB
testcase_20 AC 39 ms
53,436 KB
testcase_21 AC 38 ms
53,436 KB
testcase_22 AC 39 ms
53,436 KB
testcase_23 AC 39 ms
53,436 KB
testcase_24 AC 39 ms
53,436 KB
testcase_25 WA -
testcase_26 AC 55 ms
63,820 KB
testcase_27 WA -
testcase_28 AC 55 ms
63,832 KB
testcase_29 AC 54 ms
63,832 KB
testcase_30 WA -
testcase_31 AC 54 ms
63,832 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

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)+food[i][0]
                else:
                    tmp=T*((d-1)//2)+las
            else:
                if d%2==0:
                    tmp=T*(d//2-1)+food[i][2]+las
                else:
                    tmp=T*((d-1)//2)+min(las,-food[j][1])
        ans=max(ans,tmp)
print(ans)
0