結果

問題 No.2037 NAND Pyramid
ユーザー titiatitia
提出日時 2022-08-30 03:48:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,048 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 258,344 KB
最終ジャッジ日時 2024-04-24 15:19:26
合計ジャッジ時間 22,311 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,760 KB
testcase_01 AC 41 ms
53,504 KB
testcase_02 AC 43 ms
53,888 KB
testcase_03 AC 44 ms
53,504 KB
testcase_04 AC 42 ms
53,504 KB
testcase_05 AC 42 ms
53,632 KB
testcase_06 AC 43 ms
53,248 KB
testcase_07 AC 764 ms
253,824 KB
testcase_08 AC 893 ms
256,128 KB
testcase_09 AC 665 ms
252,544 KB
testcase_10 AC 596 ms
250,496 KB
testcase_11 AC 730 ms
254,336 KB
testcase_12 AC 375 ms
170,496 KB
testcase_13 AC 334 ms
158,208 KB
testcase_14 AC 584 ms
241,664 KB
testcase_15 AC 826 ms
255,616 KB
testcase_16 AC 603 ms
244,096 KB
testcase_17 AC 1,030 ms
257,920 KB
testcase_18 AC 1,023 ms
258,204 KB
testcase_19 AC 1,036 ms
258,332 KB
testcase_20 AC 1,005 ms
258,344 KB
testcase_21 AC 112 ms
98,796 KB
testcase_22 AC 111 ms
98,448 KB
testcase_23 AC 939 ms
257,608 KB
testcase_24 AC 413 ms
189,100 KB
testcase_25 AC 1,048 ms
257,892 KB
testcase_26 AC 1,038 ms
257,744 KB
testcase_27 AC 1,036 ms
257,860 KB
testcase_28 AC 1,000 ms
258,068 KB
testcase_29 AC 999 ms
257,896 KB
testcase_30 AC 185 ms
120,444 KB
testcase_31 AC 1,047 ms
258,020 KB
testcase_32 AC 1,008 ms
258,056 KB
testcase_33 AC 50 ms
60,928 KB
testcase_34 AC 56 ms
64,384 KB
testcase_35 AC 59 ms
65,152 KB
testcase_36 AC 56 ms
63,104 KB
testcase_37 AC 55 ms
64,256 KB
testcase_38 AC 57 ms
65,408 KB
testcase_39 AC 59 ms
64,384 KB
testcase_40 AC 56 ms
62,720 KB
testcase_41 AC 62 ms
64,640 KB
testcase_42 AC 56 ms
64,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import deque

N,K=map(int,input().split())
S=list(input().strip())

def calc(S):
    A=["1"]*(len(S)-1)
    for i in range(len(S)-1):
        if S[i]=="1" and S[i+1]=="1":
            A[i]="0"
    return A

for i in range(100):
    if len(S)>=K+1:
        S=calc(S)
    else:
        break

S=deque(S)
while len(S)>=K+2:
    S.popleft()
    S.pop()

S=list(S)
if len(S)==K:
    print("".join(S))
else:
    S=calc(S)
    print("".join(S))

    
0