結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,444 KB
testcase_01 AC 37 ms
53,444 KB
testcase_02 AC 37 ms
53,444 KB
testcase_03 AC 36 ms
53,444 KB
testcase_04 AC 37 ms
53,444 KB
testcase_05 WA -
testcase_06 AC 37 ms
53,444 KB
testcase_07 AC 37 ms
53,444 KB
testcase_08 AC 36 ms
53,444 KB
testcase_09 AC 36 ms
53,444 KB
testcase_10 AC 37 ms
53,444 KB
testcase_11 AC 84 ms
70,344 KB
testcase_12 AC 92 ms
70,420 KB
testcase_13 AC 92 ms
68,348 KB
testcase_14 AC 88 ms
70,420 KB
testcase_15 AC 90 ms
70,408 KB
testcase_16 AC 80 ms
68,296 KB
testcase_17 AC 73 ms
68,300 KB
testcase_18 AC 37 ms
53,444 KB
testcase_19 AC 36 ms
53,444 KB
testcase_20 AC 36 ms
53,444 KB
testcase_21 AC 37 ms
53,444 KB
testcase_22 AC 38 ms
53,444 KB
testcase_23 AC 37 ms
53,444 KB
testcase_24 AC 36 ms
53,444 KB
testcase_25 AC 53 ms
63,860 KB
testcase_26 AC 52 ms
63,840 KB
testcase_27 AC 52 ms
63,860 KB
testcase_28 AC 51 ms
63,860 KB
testcase_29 AC 53 ms
63,860 KB
testcase_30 AC 51 ms
63,852 KB
testcase_31 AC 53 ms
63,856 KB
testcase_32 AC 103 ms
72,476 KB
testcase_33 AC 104 ms
72,484 KB
testcase_34 AC 102 ms
72,484 KB
testcase_35 AC 99 ms
70,408 KB
testcase_36 WA -
testcase_37 AC 37 ms
53,444 KB
testcase_38 AC 37 ms
53,444 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)+food[i][0]
                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