結果

問題 No.2037 NAND Pyramid
ユーザー asumo0729asumo0729
提出日時 2022-08-20 17:14:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 115,032 KB
最終ジャッジ日時 2024-04-17 15:31:55
合計ジャッジ時間 6,209 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 41 ms
51,456 KB
testcase_02 AC 43 ms
51,456 KB
testcase_03 AC 42 ms
51,840 KB
testcase_04 AC 41 ms
51,840 KB
testcase_05 AC 42 ms
51,584 KB
testcase_06 AC 41 ms
52,480 KB
testcase_07 AC 117 ms
114,560 KB
testcase_08 AC 126 ms
101,324 KB
testcase_09 AC 110 ms
109,184 KB
testcase_10 AC 102 ms
102,528 KB
testcase_11 AC 111 ms
110,592 KB
testcase_12 AC 82 ms
85,760 KB
testcase_13 AC 78 ms
81,792 KB
testcase_14 AC 97 ms
98,432 KB
testcase_15 AC 119 ms
98,636 KB
testcase_16 AC 97 ms
98,688 KB
testcase_17 AC 137 ms
107,712 KB
testcase_18 AC 138 ms
110,940 KB
testcase_19 AC 141 ms
112,424 KB
testcase_20 AC 145 ms
110,016 KB
testcase_21 AC 144 ms
114,520 KB
testcase_22 AC 148 ms
115,032 KB
testcase_23 AC 148 ms
111,672 KB
testcase_24 AC 149 ms
114,644 KB
testcase_25 AC 137 ms
108,096 KB
testcase_26 AC 136 ms
110,548 KB
testcase_27 AC 143 ms
109,308 KB
testcase_28 AC 140 ms
107,708 KB
testcase_29 AC 140 ms
107,832 KB
testcase_30 AC 146 ms
114,880 KB
testcase_31 AC 142 ms
110,144 KB
testcase_32 AC 144 ms
110,140 KB
testcase_33 AC 49 ms
58,752 KB
testcase_34 AC 56 ms
62,208 KB
testcase_35 AC 56 ms
62,464 KB
testcase_36 AC 53 ms
60,544 KB
testcase_37 AC 56 ms
62,464 KB
testcase_38 AC 57 ms
62,208 KB
testcase_39 AC 57 ms
61,568 KB
testcase_40 AC 51 ms
60,288 KB
testcase_41 AC 55 ms
61,568 KB
testcase_42 AC 55 ms
62,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
S = input()
SN1 = []
SN2 = []
for i in range(N - 1):
    if S[i] == S[i + 1] == '1':
        x = '0'
    else:
        x= '1'
    SN1.append(x)
for i in range(N - 2):
    if SN1[i] == SN1[i + 1] == '1':
        x = '0'
    else:
        x= '1'
    SN2.append(x)
if (N - 1 - K) % 2 == 0:
    h = (N - 1 - K) // 2
    ans = SN1[h:N - 1 -h]
else:
    h = (N - 2 - K) // 2
    ans = SN2[h:N - 2 -h]
ans = ''.join(ans)
print(ans)
0