結果

問題 No.592 括弧の対応 (2)
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-28 03:47:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 5,000 ms
コード長 202 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 93,480 KB
最終ジャッジ日時 2023-09-20 18:29:03
合計ジャッジ時間 1,819 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,292 KB
testcase_01 AC 119 ms
89,316 KB
testcase_02 AC 120 ms
93,480 KB
testcase_03 AC 114 ms
86,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = str(input())

C = [-1]*n

d = []
for i in range(n):
    if s[i] == '(':
        d.append(i)
    else:
        j = d.pop()
        C[i] = j+1
        C[j] = i+1

print(*C, sep='\n')
0