結果

問題 No.1715 Dinner 2
ユーザー shinichishinichi
提出日時 2021-10-22 21:45:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 734 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 75,720 KB
最終ジャッジ日時 2023-10-24 12:47:37
合計ジャッジ時間 3,623 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 36 ms
53,524 KB
testcase_02 AC 35 ms
53,524 KB
testcase_03 AC 36 ms
53,524 KB
testcase_04 AC 35 ms
53,524 KB
testcase_05 WA -
testcase_06 AC 36 ms
53,524 KB
testcase_07 AC 35 ms
53,524 KB
testcase_08 AC 36 ms
53,524 KB
testcase_09 AC 36 ms
53,524 KB
testcase_10 WA -
testcase_11 AC 109 ms
75,464 KB
testcase_12 AC 112 ms
75,592 KB
testcase_13 AC 118 ms
75,708 KB
testcase_14 AC 108 ms
75,528 KB
testcase_15 AC 101 ms
75,368 KB
testcase_16 AC 102 ms
75,448 KB
testcase_17 AC 83 ms
75,240 KB
testcase_18 AC 36 ms
53,524 KB
testcase_19 AC 36 ms
53,524 KB
testcase_20 AC 36 ms
53,524 KB
testcase_21 AC 36 ms
53,524 KB
testcase_22 WA -
testcase_23 AC 36 ms
53,524 KB
testcase_24 AC 36 ms
53,524 KB
testcase_25 AC 49 ms
63,908 KB
testcase_26 AC 47 ms
61,848 KB
testcase_27 AC 51 ms
63,912 KB
testcase_28 AC 50 ms
63,908 KB
testcase_29 AC 47 ms
61,844 KB
testcase_30 AC 46 ms
61,844 KB
testcase_31 AC 51 ms
63,920 KB
testcase_32 AC 122 ms
75,716 KB
testcase_33 AC 123 ms
75,624 KB
testcase_34 AC 120 ms
75,700 KB
testcase_35 AC 124 ms
75,720 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(min(-pi, -pi-pj+qi), min(-pi-pj+qj, -pj))
        else:
            now = ii * N // 2 + jj * N // 2
            ans = now + max(-pi, -pj)
    result = max(result, ans)
print(result)

0