結果

問題 No.2542 Yokan for Two
ユーザー titiatitia
提出日時 2023-11-25 00:36:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 183,392 KB
最終ジャッジ日時 2023-11-25 00:36:56
合計ジャッジ時間 9,129 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 78 ms
87,888 KB
testcase_04 AC 87 ms
83,608 KB
testcase_05 AC 188 ms
130,768 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 262 ms
148,540 KB
testcase_08 AC 100 ms
100,032 KB
testcase_09 AC 256 ms
158,148 KB
testcase_10 AC 66 ms
78,756 KB
testcase_11 AC 78 ms
79,512 KB
testcase_12 AC 159 ms
148,828 KB
testcase_13 AC 66 ms
76,580 KB
testcase_14 AC 218 ms
138,756 KB
testcase_15 AC 288 ms
178,228 KB
testcase_16 AC 255 ms
152,292 KB
testcase_17 AC 222 ms
147,880 KB
testcase_18 AC 269 ms
168,788 KB
testcase_19 AC 147 ms
107,140 KB
testcase_20 AC 124 ms
98,436 KB
testcase_21 AC 133 ms
101,636 KB
testcase_22 AC 138 ms
105,988 KB
testcase_23 AC 141 ms
104,580 KB
testcase_24 AC 34 ms
53,460 KB
testcase_25 AC 35 ms
53,460 KB
testcase_26 AC 35 ms
53,460 KB
testcase_27 AC 36 ms
53,460 KB
testcase_28 AC 40 ms
59,840 KB
testcase_29 AC 94 ms
108,824 KB
testcase_30 AC 214 ms
142,132 KB
testcase_31 AC 217 ms
142,792 KB
testcase_32 AC 211 ms
139,908 KB
testcase_33 AC 229 ms
141,316 KB
testcase_34 AC 263 ms
154,344 KB
testcase_35 AC 276 ms
164,704 KB
testcase_36 AC 257 ms
155,804 KB
testcase_37 AC 284 ms
168,764 KB
testcase_38 AC 276 ms
164,168 KB
testcase_39 AC 302 ms
183,392 KB
testcase_40 AC 291 ms
178,868 KB
testcase_41 AC 274 ms
165,140 KB
testcase_42 AC 273 ms
167,972 KB
testcase_43 AC 280 ms
168,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

L,N=map(int,input().split())
X=list(map(int,input().split()))

DP={abs(X[0]-(L-X[-1]))}

for i in range(1,N):
    NDP=set()

    for dp in DP:
        NDP.add(abs(dp+X[i]-X[i-1]))
        NDP.add(abs(dp-X[i]+X[i-1]))

    DP=NDP

print(min(DP))
0