結果
問題 | No.592 括弧の対応 (2) |
ユーザー | first_vil |
提出日時 | 2021-12-08 09:44:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 138 ms / 5,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 301 ms |
コンパイル使用メモリ | 87,320 KB |
実行使用メモリ | 89,296 KB |
最終ジャッジ日時 | 2023-09-23 01:21:35 |
合計ジャッジ時間 | 1,745 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 90 ms
71,732 KB |
testcase_01 | AC | 138 ms
89,060 KB |
testcase_02 | AC | 138 ms
89,296 KB |
testcase_03 | AC | 132 ms
88,932 KB |
ソースコード
import sys # input = lambda: sys.stdin.buffer.readline() input = lambda: sys.stdin.readline().rstrip() mi = lambda: map(int, input().split()) li = lambda: list(mi()) from collections import deque n = int(input()) st = deque() ans = [0] * n for i, c in enumerate(list(input())): if c == "(": st.append(i) else: j = st.pop() ans[i] = j + 1 ans[j] = i + 1 for x in ans: print(x)