結果

問題 No.592 括弧の対応 (2)
ユーザー convexineqconvexineq
提出日時 2021-03-10 22:24:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 107 ms / 5,000 ms
コード長 203 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 92,160 KB
最終ジャッジ日時 2024-04-20 16:36:24
合計ジャッジ時間 1,342 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,712 KB
testcase_01 AC 103 ms
85,504 KB
testcase_02 AC 107 ms
92,160 KB
testcase_03 AC 102 ms
85,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
ans = [1]*n
st = []
for i,si in enumerate(s):
    if si=="(":
        st.append(i)
    else:
        v = st.pop()
        ans[i] += v
        ans[v] += i
print(*ans,sep="\n")
0