結果

問題 No.2037 NAND Pyramid
ユーザー ニックネームニックネーム
提出日時 2022-08-12 22:13:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 307 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 17,412 KB
最終ジャッジ日時 2023-08-03 02:22:43
合計ジャッジ時間 12,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
17,412 KB
testcase_01 AC 17 ms
8,136 KB
testcase_02 AC 17 ms
7,792 KB
testcase_03 AC 15 ms
7,988 KB
testcase_04 AC 15 ms
8,196 KB
testcase_05 AC 15 ms
7,776 KB
testcase_06 AC 15 ms
7,804 KB
testcase_07 AC 479 ms
8,772 KB
testcase_08 AC 25 ms
8,916 KB
testcase_09 AC 445 ms
8,752 KB
testcase_10 AC 958 ms
9,184 KB
testcase_11 AC 956 ms
9,004 KB
testcase_12 AC 335 ms
8,524 KB
testcase_13 AC 17 ms
8,464 KB
testcase_14 AC 1,117 ms
8,868 KB
testcase_15 AC 256 ms
8,824 KB
testcase_16 AC 1,086 ms
9,056 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
s = input()
if (n-k)%2:
    t = ""
    for i in range(n-1):
        t += "0" if s[i:i+2] == "11" else "1"
    n -= 1
    s = t
if k == n: print(s); exit()
ans = ""
for i in range((n-k)//2, (n-k)//2+k):
    ans += "0" if s[i] == "0" or s[i-1:i+2] == "010" else "1"
print(ans)
0