結果
問題 |
No.22 括弧の対応
|
ユーザー |
|
提出日時 | 2019-06-06 10:31:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 295 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-09-25 02:03:18 |
合計ジャッジ時間 | 1,578 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 WA * 6 RE * 10 |
ソースコード
n, k = map(int, input().split()) s = list(input()) x = 1 l = [] for i in range(n): if s[i] == '(': l.append(x) x += 1 elif s[i] == ')': x -= 1 l.append(x) y = l[k-1] if k >= n//2: print(l.index(y) + 1) else: print(n - l[::-1].index(k))