結果
問題 | No.2037 NAND Pyramid |
ユーザー | ああいい |
提出日時 | 2022-08-14 12:46:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,599 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 256,116 KB |
最終ジャッジ日時 | 2024-10-01 05:58:37 |
合計ジャッジ時間 | 5,231 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
52,816 KB |
testcase_01 | AC | 37 ms
52,664 KB |
testcase_02 | AC | 38 ms
52,536 KB |
testcase_03 | AC | 36 ms
53,356 KB |
testcase_04 | AC | 38 ms
52,608 KB |
testcase_05 | AC | 38 ms
52,132 KB |
testcase_06 | AC | 38 ms
54,484 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 141 ms
121,208 KB |
testcase_22 | AC | 145 ms
121,288 KB |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 270 ms
256,116 KB |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
ソースコード
import sys def calc(l): ans = [] for i in range(len(l) - 1): ans.append(1 - (l[i] & l[i+1])) return ans N,K = map(int,input().split()) K = N - K S = input() l = list(S) l = list(map(int,l)) if K % 2 == 1: ll = [] for i in range(N - 1): ll.append(1 - (l[i] & l[i+1])) l = ll K -= 1 N -= 1 if K == 0: print(*l,sep = "") exit() if K <= 20 or N <= 20: for _ in range(K): l = calc(l) print(*l,sep = "") exit() u = K // 2 start = u end = N - u - 1 ans = [0] * (N - K) hidari = False migi = False for i in range(u): if l[i] == 0: hidari = True break for i in range(end + 1,N): if l[i] == 0: migi = True break """ if l[start] == 1: if l[u+1] == 1: ans[0] = 1 else: if hidari: ans[0] = 0 else: ans[0] = 1 else: ans[0] = 0 if l[end] == 1: if l[end-1] == 1: ans[-1] = 1 else: if migi: ans[-1] = 0 else: ans[-1] = 1 else: ans[-1] = 0 """ if l[start] == 1: if l[start + 1] == 1: ans[0] = 1 else: if l[start - 1] == 1: ans[0] = 1 else: ans[0] = 0 if l[end] == 1: if l[end - 1] == 0 and l[end] + 1 == 0: ans[-1] = 0 else: ans[-1] = 1 for i in range(1,N - K - 1): if l[start+i] == 0: ans[i] = 0 continue else: if l[start + i - 1] == 0 and l[start + i + 1] == 0: ans[i] = 0 else: ans[i] = 1 print(*ans,sep = "") print(start,end)