結果

問題 No.2037 NAND Pyramid
ユーザー first_vilfirst_vil
提出日時 2022-08-12 22:18:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 1,106 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 183,900 KB
最終ジャッジ日時 2023-10-24 10:30:06
合計ジャッジ時間 6,520 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,496 KB
testcase_01 AC 38 ms
53,496 KB
testcase_02 AC 37 ms
53,496 KB
testcase_03 AC 41 ms
53,496 KB
testcase_04 AC 39 ms
53,496 KB
testcase_05 AC 39 ms
53,496 KB
testcase_06 AC 37 ms
53,496 KB
testcase_07 AC 152 ms
147,060 KB
testcase_08 AC 167 ms
157,616 KB
testcase_09 AC 132 ms
137,524 KB
testcase_10 AC 104 ms
111,100 KB
testcase_11 AC 138 ms
137,744 KB
testcase_12 AC 91 ms
98,092 KB
testcase_13 AC 82 ms
94,012 KB
testcase_14 AC 100 ms
105,524 KB
testcase_15 AC 149 ms
146,908 KB
testcase_16 AC 103 ms
105,540 KB
testcase_17 AC 155 ms
151,968 KB
testcase_18 AC 160 ms
151,968 KB
testcase_19 AC 202 ms
183,516 KB
testcase_20 AC 194 ms
183,516 KB
testcase_21 AC 83 ms
92,080 KB
testcase_22 AC 83 ms
92,084 KB
testcase_23 AC 202 ms
183,900 KB
testcase_24 AC 204 ms
183,900 KB
testcase_25 AC 205 ms
183,124 KB
testcase_26 AC 158 ms
151,964 KB
testcase_27 AC 194 ms
183,508 KB
testcase_28 AC 193 ms
183,124 KB
testcase_29 AC 158 ms
151,964 KB
testcase_30 AC 195 ms
183,900 KB
testcase_31 AC 155 ms
152,352 KB
testcase_32 AC 189 ms
183,512 KB
testcase_33 AC 43 ms
59,616 KB
testcase_34 AC 45 ms
59,616 KB
testcase_35 AC 49 ms
61,664 KB
testcase_36 AC 42 ms
59,616 KB
testcase_37 AC 45 ms
61,664 KB
testcase_38 AC 44 ms
61,664 KB
testcase_39 AC 42 ms
61,664 KB
testcase_40 AC 43 ms
59,616 KB
testcase_41 AC 44 ms
61,664 KB
testcase_42 AC 44 ms
59,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

int1 = lambda x: int(x) - 1

# input = lambda: sys.stdin.buffer.readline()
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
i1 = lambda: int1(input())
mi = lambda: map(int, input().split())
mi1 = lambda: map(int1, input().split())
li = lambda: list(mi())
li1 = lambda: list(mi1())
lli = lambda n: [li() for _ in range(n)]

INF = float("inf")
mod = int(1e9 + 7)
# mod = 998244353


def next(s):
    a = []
    for j in range(len(s) - 1):
        a.append("0" if s[j : j + 2] == "11" else "1")
    return a


def show(s):
    n = len(s)
    t = [" ".join(list(s))]
    m = [s]
    for i in range(1, n)[::-1]:
        t.append(" " * (n - i) + " ".join(next(m[-1])))
        m.append("".join(next(m[-1])))
    for v in t[::-1]:
        print(v)


n, k = mi()
s = input()

for _ in range(2):
    s = "".join(next(s))
    n -= 1
    if k == n:
        print(s)
        exit(0)

for _ in range(2):
    s = "".join(next(s))
    n -= 1
    if k == n:
        print(s)
        exit(0)
    if (k & 1) == (n & 1):
        d = (n - k) // 2
        print(s[d : n - d])
        exit(0)
0