結果

問題 No.2037 NAND Pyramid
ユーザー lam6er
提出日時 2025-04-09 21:00:57
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 686 bytes
コンパイル時間 305 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 287,540 KB
最終ジャッジ日時 2025-04-09 21:01:54
合計ジャッジ時間 4,384 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 3 TLE * 1 -- * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    N = int(data[0])
    K = int(data[1])
    S = data[2]
    t = N - K
    result = []
    for i in range(K):
        # Compute window of size t+1 starting at i
        window = S[i:i+t+1]
        current = [c == '1' for c in window]
        for _ in range(t):
            next_current = []
            for j in range(len(current)-1):
                a = current[j]
                b = current[j+1]
                next_current.append(not (a and b))
            current = next_current
        result.append('1' if current[0] else '0')
    print(''.join(result))
    
if __name__ == "__main__":
    main()
0