結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-22 01:00:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 753 bytes |
| 記録 | |
| コンパイル時間 | 66 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-20 07:43:07 |
| 合計ジャッジ時間 | 1,298 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
n, k = map(int, input().split())
s = list(input())
close_index = 0
open_index = len(s) - 1
is_find = False
while close_index < len(s):
if s[close_index] == ')':
s[close_index] = 'checked'
open_index = close_index
while open_index >= 0:
if s[open_index] == '(':
s[open_index] = 'checked'
if close_index + 1 == k:
print(open_index + 1)
is_find = True
break
elif open_index + 1 == k:
print(close_index + 1)
is_find = True
break
break
else:
open_index -= 1
if is_find: break
close_index += 1