結果

問題 No.592 括弧の対応 (2)
ユーザー Yuhel Tanaka
提出日時 2018-12-20 14:02:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 278 ms / 5,000 ms
コード長 244 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 41,840 KB
最終ジャッジ日時 2024-09-25 08:56:43
合計ジャッジ時間 1,802 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

l=[]
n=int(input())
d={i:0 for i in range(1,n+1)}

for i,j in enumerate(input(),start=1):
    if j=="(":
        l.append((i,j))
    elif l[-1][1]=="(" and j==")":
        d[l[-1][0]],d[i]=i,l[-1][0]
        l.pop()

print(*d.values(),sep="\n")
0