結果

問題 No.2423 Merge Stones
ユーザー hiryuNhiryuN
提出日時 2023-08-12 14:44:29
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 791 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,472 KB
実行使用メモリ 76,676 KB
最終ジャッジ日時 2024-04-30 07:04:42
合計ジャッジ時間 8,277 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
58,228 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 31 ms
52,268 KB
testcase_05 AC 35 ms
60,152 KB
testcase_06 AC 41 ms
62,240 KB
testcase_07 WA -
testcase_08 AC 37 ms
58,756 KB
testcase_09 AC 38 ms
59,184 KB
testcase_10 AC 44 ms
63,136 KB
testcase_11 AC 119 ms
73,968 KB
testcase_12 AC 84 ms
76,620 KB
testcase_13 AC 99 ms
76,064 KB
testcase_14 AC 98 ms
76,212 KB
testcase_15 AC 92 ms
76,164 KB
testcase_16 AC 99 ms
76,088 KB
testcase_17 AC 87 ms
76,016 KB
testcase_18 AC 96 ms
76,612 KB
testcase_19 AC 82 ms
76,332 KB
testcase_20 AC 88 ms
76,548 KB
testcase_21 AC 97 ms
76,368 KB
testcase_22 AC 94 ms
76,296 KB
testcase_23 AC 84 ms
76,152 KB
testcase_24 AC 110 ms
76,492 KB
testcase_25 AC 92 ms
76,248 KB
testcase_26 AC 88 ms
76,392 KB
testcase_27 AC 96 ms
76,168 KB
testcase_28 AC 110 ms
76,360 KB
testcase_29 WA -
testcase_30 AC 91 ms
76,188 KB
testcase_31 AC 91 ms
76,100 KB
testcase_32 AC 101 ms
76,236 KB
testcase_33 AC 90 ms
76,000 KB
testcase_34 AC 92 ms
76,120 KB
testcase_35 AC 84 ms
75,996 KB
testcase_36 AC 90 ms
76,560 KB
testcase_37 AC 90 ms
76,292 KB
testcase_38 AC 90 ms
76,064 KB
testcase_39 WA -
testcase_40 AC 94 ms
76,260 KB
testcase_41 AC 95 ms
76,312 KB
testcase_42 AC 102 ms
76,304 KB
testcase_43 AC 81 ms
76,040 KB
testcase_44 WA -
testcase_45 AC 83 ms
76,052 KB
testcase_46 AC 96 ms
76,100 KB
testcase_47 AC 85 ms
76,080 KB
testcase_48 AC 87 ms
76,120 KB
testcase_49 AC 84 ms
75,956 KB
testcase_50 AC 95 ms
76,080 KB
testcase_51 AC 93 ms
71,340 KB
testcase_52 AC 91 ms
70,936 KB
testcase_53 AC 91 ms
71,204 KB
testcase_54 AC 100 ms
71,124 KB
testcase_55 AC 92 ms
71,928 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 122 ms
76,168 KB
testcase_62 AC 122 ms
76,064 KB
testcase_63 AC 118 ms
73,936 KB
testcase_64 AC 113 ms
73,060 KB
testcase_65 AC 112 ms
73,012 KB
testcase_66 AC 110 ms
74,320 KB
testcase_67 AC 113 ms
73,556 KB
testcase_68 AC 112 ms
73,112 KB
testcase_69 AC 119 ms
76,068 KB
testcase_70 AC 112 ms
72,884 KB
testcase_71 AC 124 ms
76,224 KB
testcase_72 AC 110 ms
75,980 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][ii] or C[(j+1)%n][ii]:
                    C[j][ii]=1
                    C[(j+1)%n][ii]=1
                    
ans=0                    
for i in range(n):
    ans=max(ans,C[i][0])
print(ans)
#print(C)
0