結果
問題 | No.592 括弧の対応 (2) |
ユーザー |
![]() |
提出日時 | 2020-05-16 22:07:33 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 262 ms / 5,000 ms |
コード長 | 228 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 19,140 KB |
最終ジャッジ日時 | 2024-09-22 20:50:21 |
合計ジャッジ時間 | 1,668 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) S=input() T=[] Ans=[0]*n for i in range(n): if S[i]=="(": T.append(i+1) else: p=T.pop() Ans[i]=p Ans[p-1]=i+1 for ans in Ans: print(ans)