結果

問題 No.1242 高橋君とすごろく
ユーザー googol_S0googol_S0
提出日時 2020-10-02 21:39:22
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 82 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 76,664 KB
最終ジャッジ日時 2023-09-27 08:36:33
合計ジャッジ時間 3,574 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,032 KB
testcase_01 AC 71 ms
71,036 KB
testcase_02 AC 72 ms
71,368 KB
testcase_03 AC 71 ms
71,192 KB
testcase_04 AC 70 ms
71,192 KB
testcase_05 AC 71 ms
71,220 KB
testcase_06 AC 69 ms
71,336 KB
testcase_07 AC 71 ms
71,348 KB
testcase_08 AC 72 ms
71,308 KB
testcase_09 AC 71 ms
71,040 KB
testcase_10 AC 79 ms
76,408 KB
testcase_11 AC 79 ms
76,272 KB
testcase_12 AC 77 ms
76,228 KB
testcase_13 AC 79 ms
76,604 KB
testcase_14 AC 79 ms
76,452 KB
testcase_15 AC 80 ms
76,468 KB
testcase_16 AC 80 ms
76,540 KB
testcase_17 AC 78 ms
76,428 KB
testcase_18 AC 80 ms
76,256 KB
testcase_19 AC 80 ms
76,584 KB
testcase_20 AC 82 ms
76,424 KB
testcase_21 AC 80 ms
76,664 KB
testcase_22 AC 73 ms
71,324 KB
testcase_23 AC 72 ms
71,268 KB
testcase_24 AC 76 ms
75,900 KB
testcase_25 AC 80 ms
76,352 KB
testcase_26 AC 76 ms
75,732 KB
testcase_27 AC 71 ms
71,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=[0]+list(map(int,input().split()))
K+=1
for i in range(K):
  A[i]-=1
for i in range(K-1):
  if A[i+1]-A[i]>20:
    N-=A[i+1]-A[i]-20
    for j in range(K-1,i,-1):
      A[j]-=A[i+1]-A[i]-20
if N-A[-1]>20:
  N=A[-1]+20
A=set(A)
DP=[1]*(N+5)
for i in range(N-2,-1,-1):
  if i in A:
    DP[i]=0
    continue
  for j in range(1,7):
    DP[i]&=(DP[i+j]|DP[i+7-j])
if DP[0]:
  print('Yes')
else:
  print('No')
0