結果

問題 No.2542 Yokan for Two
ユーザー 👑 timitimi
提出日時 2023-12-01 15:09:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 563 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 220,232 KB
最終ジャッジ日時 2023-12-01 15:09:59
合計ジャッジ時間 11,309 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
62,512 KB
testcase_01 AC 48 ms
64,200 KB
testcase_02 AC 45 ms
60,952 KB
testcase_03 AC 115 ms
108,660 KB
testcase_04 AC 204 ms
187,384 KB
testcase_05 AC 174 ms
151,412 KB
testcase_06 AC 48 ms
62,640 KB
testcase_07 AC 265 ms
210,848 KB
testcase_08 AC 119 ms
109,180 KB
testcase_09 AC 250 ms
207,724 KB
testcase_10 AC 136 ms
131,080 KB
testcase_11 AC 164 ms
154,536 KB
testcase_12 AC 149 ms
131,076 KB
testcase_13 AC 139 ms
132,640 KB
testcase_14 AC 248 ms
220,232 KB
testcase_15 AC 253 ms
220,232 KB
testcase_16 AC 247 ms
220,232 KB
testcase_17 AC 246 ms
220,232 KB
testcase_18 AC 257 ms
220,232 KB
testcase_19 AC 240 ms
220,232 KB
testcase_20 AC 236 ms
220,232 KB
testcase_21 AC 235 ms
220,232 KB
testcase_22 AC 239 ms
220,232 KB
testcase_23 AC 270 ms
220,232 KB
testcase_24 AC 59 ms
68,936 KB
testcase_25 AC 65 ms
77,380 KB
testcase_26 AC 66 ms
77,384 KB
testcase_27 AC 70 ms
78,948 KB
testcase_28 AC 69 ms
80,504 KB
testcase_29 AC 102 ms
100,840 KB
testcase_30 AC 239 ms
218,672 KB
testcase_31 AC 254 ms
218,668 KB
testcase_32 AC 243 ms
218,672 KB
testcase_33 AC 245 ms
218,672 KB
testcase_34 AC 247 ms
218,668 KB
testcase_35 AC 250 ms
218,672 KB
testcase_36 AC 282 ms
218,672 KB
testcase_37 AC 252 ms
218,672 KB
testcase_38 AC 255 ms
218,672 KB
testcase_39 AC 253 ms
218,668 KB
testcase_40 AC 259 ms
218,668 KB
testcase_41 AC 250 ms
218,668 KB
testcase_42 AC 246 ms
218,668 KB
testcase_43 AC 251 ms
218,672 KB
権限があれば一括ダウンロードができます

ソースコード

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])

dp=[0]*(2*10**5+10)
dp[0]=1
for a in A:
  ndp=[0]*(2*10**5+10)
  mod=2*10**5+10
  for i in range(2*10**5+10):
    if dp[i]==1:
      #print(a,i+a,i-a)
      ndp[(i+a)%mod]=1
      ndp[i-a]=1
  dp=ndp
  
ans=10**10
for i in range(-10**5-4,10**5+4):
  if dp[i]==1:
    d=i+X[0]-(L-X[-1])
    ans=min(ans,abs(d))
print(ans)
0