結果

問題 No.2542 Yokan for Two
ユーザー 👑 rin204rin204
提出日時 2023-11-24 21:26:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 393 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2023-11-24 21:27:34
合計ジャッジ時間 54,324 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
9,984 KB
testcase_01 AC 30 ms
9,984 KB
testcase_02 AC 30 ms
9,984 KB
testcase_03 AC 675 ms
10,880 KB
testcase_04 AC 400 ms
10,240 KB
testcase_05 AC 1,047 ms
10,752 KB
testcase_06 AC 38 ms
10,496 KB
testcase_07 AC 1,778 ms
10,752 KB
testcase_08 AC 498 ms
10,624 KB
testcase_09 AC 1,737 ms
10,752 KB
testcase_10 AC 235 ms
10,240 KB
testcase_11 AC 308 ms
10,240 KB
testcase_12 AC 777 ms
10,752 KB
testcase_13 AC 207 ms
10,240 KB
testcase_14 AC 1,922 ms
10,752 KB
testcase_15 AC 1,959 ms
10,880 KB
testcase_16 AC 1,866 ms
10,752 KB
testcase_17 AC 1,846 ms
10,752 KB
testcase_18 AC 1,974 ms
10,880 KB
testcase_19 AC 1,050 ms
10,496 KB
testcase_20 AC 969 ms
10,496 KB
testcase_21 AC 1,023 ms
10,496 KB
testcase_22 AC 1,025 ms
10,496 KB
testcase_23 AC 1,010 ms
10,496 KB
testcase_24 AC 123 ms
10,880 KB
testcase_25 AC 193 ms
10,880 KB
testcase_26 AC 204 ms
10,880 KB
testcase_27 AC 219 ms
10,880 KB
testcase_28 AC 230 ms
10,880 KB
testcase_29 AC 559 ms
10,880 KB
testcase_30 AC 1,948 ms
10,880 KB
testcase_31 AC 1,916 ms
10,880 KB
testcase_32 AC 1,953 ms
10,880 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 AC 1,947 ms
10,880 KB
testcase_37 TLE -
testcase_38 AC 1,948 ms
10,880 KB
testcase_39 AC 1,970 ms
10,880 KB
testcase_40 TLE -
testcase_41 AC 1,974 ms
10,880 KB
testcase_42 AC 1,948 ms
10,880 KB
testcase_43 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

l, n = map(int, input().split())
X = list(map(int, input().split()))
A = []
for i in range(n - 1):
    A.append(X[i + 1] - X[i])
tf = [False] * (l + 1)
tf[0] = True
for a in A:
    for i in range(l, a - 1, -1):
        tf[i] |= tf[i - a]

aa = X[0]
bb = l - X[-1]
ans = l
for i in range(l):
    if tf[i]:
        a_ = aa + i
        b_ = l - a_
        ans = min(ans, abs(a_ - b_))
print(ans)
0