結果

問題 No.2542 Yokan for Two
ユーザー 👑 tatyamtatyam
提出日時 2023-11-24 22:01:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,564 KB
最終ジャッジ日時 2023-11-24 22:01:48
合計ジャッジ時間 3,850 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 61 ms
76,400 KB
testcase_04 AC 48 ms
73,132 KB
testcase_05 AC 61 ms
76,204 KB
testcase_06 AC 40 ms
61,308 KB
testcase_07 AC 61 ms
76,316 KB
testcase_08 AC 59 ms
76,136 KB
testcase_09 AC 62 ms
76,288 KB
testcase_10 AC 46 ms
72,108 KB
testcase_11 AC 48 ms
73,268 KB
testcase_12 AC 60 ms
76,160 KB
testcase_13 AC 47 ms
72,244 KB
testcase_14 AC 59 ms
76,312 KB
testcase_15 AC 59 ms
76,388 KB
testcase_16 AC 59 ms
76,352 KB
testcase_17 AC 58 ms
76,272 KB
testcase_18 AC 60 ms
76,412 KB
testcase_19 AC 54 ms
75,176 KB
testcase_20 AC 57 ms
75,176 KB
testcase_21 AC 53 ms
75,176 KB
testcase_22 AC 53 ms
75,176 KB
testcase_23 AC 53 ms
75,176 KB
testcase_24 AC 43 ms
64,376 KB
testcase_25 AC 46 ms
66,916 KB
testcase_26 AC 46 ms
66,896 KB
testcase_27 AC 47 ms
66,936 KB
testcase_28 AC 49 ms
69,404 KB
testcase_29 AC 62 ms
76,400 KB
testcase_30 AC 53 ms
75,176 KB
testcase_31 AC 53 ms
75,176 KB
testcase_32 AC 53 ms
75,176 KB
testcase_33 AC 53 ms
75,176 KB
testcase_34 AC 54 ms
75,176 KB
testcase_35 AC 54 ms
75,176 KB
testcase_36 AC 54 ms
75,176 KB
testcase_37 AC 54 ms
75,176 KB
testcase_38 AC 55 ms
75,176 KB
testcase_39 AC 61 ms
76,564 KB
testcase_40 AC 60 ms
76,556 KB
testcase_41 AC 58 ms
76,432 KB
testcase_42 AC 59 ms
76,440 KB
testcase_43 AC 58 ms
76,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.buffer.readline

L, N = map(int, input().split())
X = list(map(int, input().split()))
X.append(L)
for i in range(N, 0, -1):
    X[i] -= X[i - 1]

dp0 = 1 << L
dp1 = 0

for x in X:
    dp0 <<= x
    dp1 >>= x
    if N:
        N -= 1
        dp0 = dp1 = dp0 | dp1

ans = bin(dp1)[:1:-1]
print(min(abs(i - L) for i, c in enumerate(ans) if c == '1'))
0