結果
問題 |
No.22 括弧の対応
|
ユーザー |
![]() |
提出日時 | 2022-10-22 10:57:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 49 ms / 5,000 ms |
コード長 | 313 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,284 KB |
実行使用メモリ | 63,792 KB |
最終ジャッジ日時 | 2024-07-01 14:03:22 |
合計ジャッジ時間 | 1,996 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
ソースコード
n,k=map(int,input().split()) l=list(input()) from collections import deque s=deque() ans=[] for i in range(n): if l[i]=="(": s.append(i) else: ans.append([i+1,s.pop()+1]) for x in ans: if x[0]==k: print(x[1]) exit() elif x[1]==k: print(x[0]) exit()