結果
問題 | No.592 括弧の対応 (2) |
ユーザー | Pump0129 |
提出日時 | 2018-04-30 02:57:04 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 212 ms / 5,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 95 ms |
コンパイル使用メモリ | 10,736 KB |
実行使用メモリ | 16,560 KB |
最終ジャッジ日時 | 2023-09-10 08:17:55 |
合計ジャッジ時間 | 1,659 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
7,808 KB |
testcase_01 | AC | 212 ms
16,552 KB |
testcase_02 | AC | 206 ms
16,440 KB |
testcase_03 | AC | 207 ms
16,560 KB |
ソースコード
if __name__ == "__main__": n = int(input()) pre_str = input() pre_res = [0 for i in range(n)] pre_stack = [] for i in range(n): if pre_str[i] == "(": pre_stack.append(i) else: res = pre_stack.pop() pre_res[res] = i pre_res[i] = res for num in pre_res: print(num + 1)