結果

問題 No.2423 Merge Stones
ユーザー hiryuNhiryuN
提出日時 2023-08-12 15:17:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 325 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 76,948 KB
最終ジャッジ日時 2024-04-30 08:45:37
合計ジャッジ時間 24,069 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
59,528 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 32 ms
53,812 KB
testcase_05 AC 39 ms
59,724 KB
testcase_06 AC 47 ms
62,664 KB
testcase_07 WA -
testcase_08 AC 36 ms
58,776 KB
testcase_09 AC 36 ms
58,608 KB
testcase_10 AC 47 ms
65,904 KB
testcase_11 AC 1,115 ms
76,672 KB
testcase_12 AC 79 ms
76,064 KB
testcase_13 AC 116 ms
76,492 KB
testcase_14 AC 107 ms
76,500 KB
testcase_15 AC 105 ms
76,584 KB
testcase_16 AC 114 ms
76,516 KB
testcase_17 AC 108 ms
76,488 KB
testcase_18 AC 113 ms
76,412 KB
testcase_19 AC 82 ms
76,148 KB
testcase_20 AC 102 ms
76,356 KB
testcase_21 AC 114 ms
76,428 KB
testcase_22 AC 112 ms
76,448 KB
testcase_23 AC 96 ms
76,332 KB
testcase_24 AC 107 ms
76,604 KB
testcase_25 AC 100 ms
76,600 KB
testcase_26 AC 108 ms
76,476 KB
testcase_27 AC 112 ms
76,448 KB
testcase_28 AC 125 ms
76,408 KB
testcase_29 WA -
testcase_30 AC 106 ms
76,568 KB
testcase_31 AC 106 ms
76,640 KB
testcase_32 AC 133 ms
76,612 KB
testcase_33 AC 107 ms
76,540 KB
testcase_34 AC 111 ms
76,252 KB
testcase_35 AC 96 ms
76,380 KB
testcase_36 AC 105 ms
76,556 KB
testcase_37 AC 102 ms
76,228 KB
testcase_38 AC 111 ms
76,480 KB
testcase_39 WA -
testcase_40 AC 110 ms
76,700 KB
testcase_41 AC 116 ms
76,696 KB
testcase_42 AC 132 ms
76,540 KB
testcase_43 AC 78 ms
76,204 KB
testcase_44 WA -
testcase_45 AC 98 ms
76,532 KB
testcase_46 AC 112 ms
76,516 KB
testcase_47 AC 99 ms
76,344 KB
testcase_48 AC 102 ms
76,464 KB
testcase_49 AC 86 ms
76,100 KB
testcase_50 AC 84 ms
76,532 KB
testcase_51 AC 279 ms
76,344 KB
testcase_52 AC 266 ms
76,368 KB
testcase_53 AC 288 ms
76,436 KB
testcase_54 AC 240 ms
76,512 KB
testcase_55 AC 246 ms
76,524 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 846 ms
76,620 KB
testcase_62 AC 1,075 ms
76,396 KB
testcase_63 AC 964 ms
76,500 KB
testcase_64 AC 1,038 ms
76,560 KB
testcase_65 AC 1,201 ms
76,524 KB
testcase_66 AC 974 ms
76,520 KB
testcase_67 AC 1,017 ms
76,628 KB
testcase_68 AC 1,056 ms
76,596 KB
testcase_69 AC 1,108 ms
76,372 KB
testcase_70 AC 1,006 ms
76,448 KB
testcase_71 AC 948 ms
76,468 KB
testcase_72 AC 822 ms
76,252 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]:
                    for jj in range(max(1,ii-k),min(50,ii+k)+1):
                        if C[(j+1)%n][jj]:
                            C[(j+1)%n][ii]=1
                            
                    
ans=0                    
for i in range(n):
    ans=max(ans,C[i][0])
print(ans)
#print(C)
0