結果

問題 No.370 道路の掃除
ユーザー ntudantuda
提出日時 2024-02-04 23:08:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 294 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 60,992 KB
最終ジャッジ日時 2024-02-04 23:08:41
合計ジャッジ時間 3,319 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,332 KB
testcase_01 AC 37 ms
53,332 KB
testcase_02 AC 39 ms
53,332 KB
testcase_03 AC 37 ms
53,332 KB
testcase_04 AC 36 ms
53,332 KB
testcase_05 AC 37 ms
53,332 KB
testcase_06 AC 37 ms
53,332 KB
testcase_07 AC 38 ms
53,332 KB
testcase_08 AC 39 ms
53,332 KB
testcase_09 AC 37 ms
53,332 KB
testcase_10 AC 39 ms
53,332 KB
testcase_11 AC 38 ms
53,332 KB
testcase_12 AC 39 ms
53,332 KB
testcase_13 AC 39 ms
53,332 KB
testcase_14 AC 39 ms
53,332 KB
testcase_15 AC 39 ms
53,332 KB
testcase_16 AC 38 ms
53,332 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 39 ms
53,332 KB
testcase_20 AC 47 ms
55,460 KB
testcase_21 AC 55 ms
55,460 KB
testcase_22 AC 43 ms
55,460 KB
testcase_23 AC 45 ms
55,460 KB
testcase_24 AC 41 ms
53,332 KB
testcase_25 AC 44 ms
55,460 KB
testcase_26 AC 50 ms
60,992 KB
testcase_27 AC 42 ms
53,332 KB
testcase_28 AC 44 ms
53,332 KB
testcase_29 AC 47 ms
55,460 KB
testcase_30 AC 51 ms
60,992 KB
testcase_31 AC 44 ms
55,460 KB
testcase_32 WA -
testcase_33 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
D = [int(input()) for _ in range(M)]
D.sort()
ans = 3 * 10 ** 4
for i in range(M - N):
    d0 = D[i]
    dn = D[i + N - 1]
    if d0 * dn < 0:
        ans = min(ans, -d0 * 2 + dn, -d0 + 2 * dn)
    else:
        ans = min(ans, max(abs(d0), abs(dn)))
print(ans)
0