結果

問題 No.2037 NAND Pyramid
ユーザー 👑 tamatotamato
提出日時 2022-08-12 22:32:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 670 bytes
コンパイル時間 573 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 107,448 KB
最終ジャッジ日時 2023-10-24 10:48:39
合計ジャッジ時間 5,214 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,552 KB
testcase_01 AC 35 ms
53,556 KB
testcase_02 AC 35 ms
53,552 KB
testcase_03 AC 35 ms
53,552 KB
testcase_04 AC 34 ms
53,556 KB
testcase_05 AC 35 ms
53,552 KB
testcase_06 AC 35 ms
53,552 KB
testcase_07 AC 104 ms
88,624 KB
testcase_08 AC 67 ms
79,008 KB
testcase_09 AC 79 ms
88,176 KB
testcase_10 AC 57 ms
85,356 KB
testcase_11 AC 87 ms
93,472 KB
testcase_12 AC 72 ms
83,220 KB
testcase_13 AC 52 ms
69,288 KB
testcase_14 AC 79 ms
91,256 KB
testcase_15 AC 77 ms
85,104 KB
testcase_16 AC 76 ms
91,792 KB
testcase_17 AC 73 ms
106,076 KB
testcase_18 AC 73 ms
106,076 KB
testcase_19 AC 90 ms
92,368 KB
testcase_20 AC 90 ms
92,368 KB
testcase_21 AC 85 ms
107,448 KB
testcase_22 AC 85 ms
107,448 KB
testcase_23 AC 106 ms
107,104 KB
testcase_24 AC 108 ms
100,640 KB
testcase_25 AC 49 ms
75,956 KB
testcase_26 AC 71 ms
106,028 KB
testcase_27 AC 86 ms
92,824 KB
testcase_28 AC 49 ms
75,956 KB
testcase_29 AC 71 ms
106,024 KB
testcase_30 AC 109 ms
100,640 KB
testcase_31 AC 105 ms
107,388 KB
testcase_32 AC 87 ms
92,368 KB
testcase_33 AC 39 ms
59,624 KB
testcase_34 AC 45 ms
62,344 KB
testcase_35 AC 48 ms
64,392 KB
testcase_36 AC 44 ms
62,256 KB
testcase_37 AC 45 ms
62,280 KB
testcase_38 AC 48 ms
64,400 KB
testcase_39 AC 49 ms
64,340 KB
testcase_40 AC 41 ms
59,812 KB
testcase_41 AC 39 ms
59,624 KB
testcase_42 AC 40 ms
59,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    N, K = map(int, input().split())
    S = input().rstrip('\n')

    S = [int(s) for s in S]
    if (N - K) & 1:
        SS = []
        for i in range(N-1):
            SS.append((S[i] & S[i+1]) ^ 1)
        S = SS
        N -= 1
    if N == K:
        print("".join(map(str, S)))
        exit()
    
    T = []
    for i in range(K):
        j = (N - K) // 2
        SS = S[i + j - 1: i + j + 2]
        if SS[0] == SS[1] == 1 or SS[1] == SS[2] == 1:
            T.append(1)
        else:
            T.append(0)
    print("".join(map(str, T)))
    

if __name__ == '__main__':
    main()
0