結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 37 ms
53,372 KB
testcase_02 AC 37 ms
53,372 KB
testcase_03 AC 37 ms
53,372 KB
testcase_04 AC 37 ms
53,372 KB
testcase_05 WA -
testcase_06 AC 37 ms
53,372 KB
testcase_07 AC 38 ms
53,372 KB
testcase_08 AC 37 ms
53,372 KB
testcase_09 AC 37 ms
53,372 KB
testcase_10 WA -
testcase_11 AC 99 ms
75,104 KB
testcase_12 AC 103 ms
75,248 KB
testcase_13 AC 107 ms
75,268 KB
testcase_14 AC 97 ms
75,228 KB
testcase_15 AC 101 ms
75,216 KB
testcase_16 AC 91 ms
75,088 KB
testcase_17 AC 83 ms
75,076 KB
testcase_18 AC 38 ms
53,372 KB
testcase_19 AC 37 ms
53,372 KB
testcase_20 AC 37 ms
53,372 KB
testcase_21 AC 37 ms
53,372 KB
testcase_22 WA -
testcase_23 AC 38 ms
53,372 KB
testcase_24 AC 37 ms
53,372 KB
testcase_25 AC 50 ms
63,756 KB
testcase_26 AC 48 ms
61,680 KB
testcase_27 AC 52 ms
63,760 KB
testcase_28 AC 50 ms
63,736 KB
testcase_29 AC 48 ms
61,692 KB
testcase_30 AC 48 ms
61,692 KB
testcase_31 AC 53 ms
63,768 KB
testcase_32 AC 110 ms
75,240 KB
testcase_33 AC 110 ms
75,276 KB
testcase_34 AC 109 ms
75,244 KB
testcase_35 AC 109 ms
75,244 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations



N, D = map(int, input().split())
P = []
Q = []
for _ in range(N):
    p, q = map(int, input().split())
    P.append(p)
    Q.append(q)

result = -1001001001001001001

for i, j in combinations(range(N), 2):
    pi, qi = P[i], Q[i]
    pj, qj = P[j], Q[j]
    ans = -1001001001001001001
    if qi+qj-pi-pj >= 0:
        ans = max(min(-pi-pj+qi, -pi), min(-pj-pj+qj, -pj))
    else:
        ii, jj = qi-pi, qj-pj
        if N % 2 == 0:
            now = ii * (N-1) // 2 + jj * (N-1) // 2
            ans = now + max(-pi-pj+qi, -pi-pj+qj)
        else:
            now = ii * N // 2 + jj * N // 2
            ans = now + max(-pi, -pj)
    result = max(result, ans)
print(result)

0