結果

問題 No.2423 Merge Stones
ユーザー hiryuNhiryuN
提出日時 2023-08-12 15:15:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 76,760 KB
最終ジャッジ日時 2024-04-30 08:40:03
合計ジャッジ時間 16,077 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
58,680 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 37 ms
52,928 KB
testcase_05 AC 42 ms
60,304 KB
testcase_06 AC 47 ms
62,292 KB
testcase_07 WA -
testcase_08 AC 41 ms
57,964 KB
testcase_09 AC 39 ms
58,208 KB
testcase_10 AC 52 ms
63,616 KB
testcase_11 AC 722 ms
76,376 KB
testcase_12 AC 89 ms
76,208 KB
testcase_13 AC 118 ms
76,040 KB
testcase_14 AC 116 ms
76,540 KB
testcase_15 AC 108 ms
76,656 KB
testcase_16 AC 114 ms
76,536 KB
testcase_17 AC 107 ms
76,752 KB
testcase_18 AC 115 ms
76,188 KB
testcase_19 AC 90 ms
76,244 KB
testcase_20 AC 108 ms
76,212 KB
testcase_21 AC 118 ms
76,532 KB
testcase_22 AC 113 ms
76,452 KB
testcase_23 AC 100 ms
76,244 KB
testcase_24 AC 113 ms
76,392 KB
testcase_25 AC 101 ms
76,092 KB
testcase_26 AC 109 ms
76,388 KB
testcase_27 AC 114 ms
76,112 KB
testcase_28 AC 124 ms
76,284 KB
testcase_29 WA -
testcase_30 AC 109 ms
76,184 KB
testcase_31 AC 114 ms
76,476 KB
testcase_32 AC 121 ms
76,356 KB
testcase_33 AC 111 ms
76,516 KB
testcase_34 AC 116 ms
76,200 KB
testcase_35 AC 103 ms
76,300 KB
testcase_36 AC 111 ms
76,212 KB
testcase_37 AC 110 ms
76,464 KB
testcase_38 AC 108 ms
76,328 KB
testcase_39 WA -
testcase_40 AC 113 ms
76,340 KB
testcase_41 AC 116 ms
76,544 KB
testcase_42 AC 141 ms
76,476 KB
testcase_43 AC 92 ms
76,060 KB
testcase_44 WA -
testcase_45 AC 105 ms
76,256 KB
testcase_46 AC 115 ms
76,452 KB
testcase_47 AC 101 ms
76,184 KB
testcase_48 AC 106 ms
76,760 KB
testcase_49 AC 95 ms
76,356 KB
testcase_50 AC 89 ms
76,208 KB
testcase_51 AC 179 ms
76,344 KB
testcase_52 AC 205 ms
76,136 KB
testcase_53 AC 187 ms
76,244 KB
testcase_54 AC 179 ms
76,268 KB
testcase_55 AC 186 ms
76,116 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 447 ms
76,300 KB
testcase_62 AC 515 ms
76,536 KB
testcase_63 AC 478 ms
76,380 KB
testcase_64 AC 503 ms
76,232 KB
testcase_65 AC 502 ms
76,248 KB
testcase_66 AC 472 ms
76,360 KB
testcase_67 AC 488 ms
76,328 KB
testcase_68 AC 503 ms
76,264 KB
testcase_69 AC 516 ms
76,248 KB
testcase_70 AC 487 ms
76,204 KB
testcase_71 AC 469 ms
76,384 KB
testcase_72 AC 438 ms
76,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
A=list(map(int,input().split()))
C=list(map(int,input().split()))
X=[0]*51
def m(A,B):
    for i in range(1,len(A)):
        if A[i]:
            for j in range(max(1,i-k),min(len(A)-1,i+k)+1):
                if B[j]:
                    return True
    return False
for i in range(n):
    Y=X[:]
    Y[C[i]]=1
    Y[0]=A[i]
    C[i]=Y
for i in range(n+2):
    for j in range(n):
        C[j]
        C[(j+1)%n]
        if m(C[j],C[(j+1)%n]):
            C[(j+1)%n][0]+=C[j][0]
            C[j][0]=0
            for ii in range(1,51):
                if C[(j+1)%n][ii]:
                    for jj in range(max(1,ii-k),min(50,ii+k)+1):
                        if C[j][jj]:
                            C[j][ii]=1
                if C[j][ii]:
                    C[(j+1)%n][ii]=1
                            
                    
ans=0                    
for i in range(n):
    ans=max(ans,C[i][0])
print(ans)
#print(C)
0