結果

問題 No.2037 NAND Pyramid
ユーザー sotanishysotanishy
提出日時 2022-08-12 22:05:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 1,077 ms
コンパイル使用メモリ 81,456 KB
実行使用メモリ 115,092 KB
最終ジャッジ日時 2023-10-24 10:11:09
合計ジャッジ時間 4,356 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,396 KB
testcase_01 AC 36 ms
53,396 KB
testcase_02 AC 36 ms
53,396 KB
testcase_03 AC 35 ms
53,396 KB
testcase_04 AC 35 ms
53,396 KB
testcase_05 AC 36 ms
53,396 KB
testcase_06 AC 35 ms
53,396 KB
testcase_07 AC 77 ms
100,512 KB
testcase_08 AC 72 ms
100,304 KB
testcase_09 AC 70 ms
96,140 KB
testcase_10 AC 62 ms
87,212 KB
testcase_11 AC 75 ms
98,540 KB
testcase_12 AC 56 ms
80,792 KB
testcase_13 AC 53 ms
72,588 KB
testcase_14 AC 65 ms
88,972 KB
testcase_15 AC 77 ms
100,700 KB
testcase_16 AC 64 ms
89,288 KB
testcase_17 AC 81 ms
111,836 KB
testcase_18 AC 80 ms
111,908 KB
testcase_19 AC 87 ms
112,196 KB
testcase_20 AC 87 ms
112,196 KB
testcase_21 AC 88 ms
107,444 KB
testcase_22 AC 88 ms
107,444 KB
testcase_23 AC 92 ms
113,516 KB
testcase_24 AC 93 ms
113,516 KB
testcase_25 AC 75 ms
108,752 KB
testcase_26 AC 80 ms
111,844 KB
testcase_27 AC 87 ms
111,924 KB
testcase_28 AC 76 ms
108,756 KB
testcase_29 AC 78 ms
111,844 KB
testcase_30 AC 91 ms
113,508 KB
testcase_31 AC 90 ms
115,092 KB
testcase_32 AC 86 ms
111,924 KB
testcase_33 AC 39 ms
59,588 KB
testcase_34 AC 41 ms
59,784 KB
testcase_35 AC 41 ms
59,784 KB
testcase_36 AC 41 ms
59,784 KB
testcase_37 AC 41 ms
59,784 KB
testcase_38 AC 41 ms
59,784 KB
testcase_39 AC 40 ms
59,784 KB
testcase_40 AC 40 ms
59,588 KB
testcase_41 AC 40 ms
59,588 KB
testcase_42 AC 41 ms
59,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

def calc(S):
    nS = [0] * (len(S)-1)
    for i in range(len(S)-1):
        nS[i] = 1 ^ (S[i] & S[i+1])
    return nS

N, K = map(int, input().split())
S = list(map(int, input().rstrip()))
for k in range(2):
    if k == N-K:
        print("".join(map(str, S)))
        exit()
    S = calc(S)

k = N - K
if k % 2 == 0:
    m = k // 2 - 1
else:
    S = calc(S)
    m = (k - 1) // 2 - 1
print("".join(map(str, S[m:len(S)-m])))
0