結果

問題 No.2542 Yokan for Two
ユーザー sasa8uyauyasasa8uyauya
提出日時 2023-11-24 21:57:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 861 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 252,600 KB
最終ジャッジ日時 2023-11-24 21:57:55
合計ジャッジ時間 15,434 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 33 ms
53,460 KB
testcase_03 AC 195 ms
167,740 KB
testcase_04 AC 159 ms
129,996 KB
testcase_05 AC 304 ms
223,064 KB
testcase_06 AC 53 ms
66,532 KB
testcase_07 AC 500 ms
252,600 KB
testcase_08 AC 179 ms
146,136 KB
testcase_09 AC 483 ms
251,960 KB
testcase_10 AC 113 ms
103,404 KB
testcase_11 AC 129 ms
111,940 KB
testcase_12 AC 244 ms
184,468 KB
testcase_13 AC 103 ms
98,052 KB
testcase_14 AC 445 ms
248,388 KB
testcase_15 AC 487 ms
247,868 KB
testcase_16 AC 465 ms
248,932 KB
testcase_17 AC 453 ms
249,124 KB
testcase_18 AC 484 ms
248,572 KB
testcase_19 AC 286 ms
235,736 KB
testcase_20 AC 263 ms
222,000 KB
testcase_21 AC 265 ms
222,000 KB
testcase_22 AC 268 ms
226,848 KB
testcase_23 AC 273 ms
228,464 KB
testcase_24 AC 73 ms
83,540 KB
testcase_25 AC 92 ms
98,244 KB
testcase_26 AC 94 ms
100,464 KB
testcase_27 AC 100 ms
103,604 KB
testcase_28 AC 103 ms
106,732 KB
testcase_29 AC 180 ms
152,104 KB
testcase_30 AC 486 ms
250,132 KB
testcase_31 AC 495 ms
252,132 KB
testcase_32 AC 515 ms
250,048 KB
testcase_33 AC 496 ms
252,204 KB
testcase_34 AC 503 ms
252,160 KB
testcase_35 AC 510 ms
252,216 KB
testcase_36 AC 505 ms
250,132 KB
testcase_37 AC 524 ms
250,132 KB
testcase_38 AC 511 ms
252,160 KB
testcase_39 AC 496 ms
247,988 KB
testcase_40 AC 515 ms
247,900 KB
testcase_41 AC 456 ms
245,844 KB
testcase_42 AC 482 ms
247,916 KB
testcase_43 AC 493 ms
247,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

l,n=map(int,input().split())
x=[0]+list(map(int,input().split()))+[l]
for i in reversed(range(1,n+2)):
  x[i]-=x[i-1]
q=[[0]*(2*l+1),[0]*(2*l+1)]
q[0][x[1]]=1
for v in x[2:]:
  nq=[[0]*(2*l+1),[0]*(2*l+1)]
  for j in range(-l,l+1):
    if q[0][j]:
      nq[0][j+v]=1
      nq[1][j-v]=1
    if q[1][j]:
      nq[0][j+v]=1
      nq[1][j-v]=1
  q=nq
g=l
for i in range(-l,l+1):
  if q[1][i]:
    g=min(g,abs(i))
print(g)
0