結果

問題 No.8126 Brainfxxk easy
コンテスト
ユーザー 👑 loop0919
提出日時 2026-04-01 21:31:22
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 318 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 116 ms
コンパイル使用メモリ 85,696 KB
実行使用メモリ 138,156 KB
最終ジャッジ日時 2026-04-01 21:31:26
合計ジャッジ時間 1,445 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
S = [s for s in input()]

answer = [0] * N
curr = 0

for s in S:
    if s == "+":
        answer[curr] += 1
    elif s == "-":
        answer[curr] -= 1
    elif s == ">":
        curr += 1
    else:
        curr -= 1

    if not (0 <= curr < N):
        print("error")
        exit()

print(*answer)
0