結果
| 問題 |
No.2037 NAND Pyramid
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 16:58:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 900 bytes |
| コンパイル時間 | 208 ms |
| コンパイル使用メモリ | 82,052 KB |
| 実行使用メモリ | 272,752 KB |
| 最終ジャッジ日時 | 2025-06-12 16:58:29 |
| 合計ジャッジ時間 | 4,110 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 3 TLE * 1 -- * 35 |
ソースコード
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N = int(input[idx])
idx += 1
K = int(input[idx])
idx += 1
S = input[idx]
# Compute for each j, the result of the reduction of S[j:j + (N-K +1)]
result = []
for j in range(K):
end = j + (N - K + 1)
current_layer = S[j:end]
# Compute the reduction
while len(current_layer) > 1:
next_layer = []
for i in range(len(current_layer) - 1):
a = int(current_layer[i])
b = int(current_layer[i+1])
if a == 1 and b == 1:
next_layer.append('0')
else:
next_layer.append('1')
current_layer = ''.join(next_layer)
result.append(current_layer[0])
print(''.join(result))
if __name__ == '__main__':
main()
gew1fw