結果

問題 No.592 括弧の対応 (2)
ユーザー ysys
提出日時 2018-08-18 05:54:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,609 ms / 5,000 ms
コード長 216 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 84,480 KB
最終ジャッジ日時 2024-04-20 22:39:14
合計ジャッジ時間 3,413 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,688 KB
testcase_01 AC 949 ms
80,432 KB
testcase_02 AC 1,609 ms
84,480 KB
testcase_03 AC 71 ms
78,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
st = []
rec = [0] * n
for i in range(n):
    if s[i] == "(":
        st.insert(0, i)
    else:
        j = st.pop(0)
        rec[i] = j
        rec[j] = i

for i in rec:
    print(i + 1)
0