結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-06-22 01:00:22 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
AC
|
| 実行時間 | 100 ms / 5,000 ms |
| コード長 | 753 bytes |
| 記録 | |
| コンパイル時間 | 332 ms |
| コンパイル使用メモリ | 20,704 KB |
| 実行使用メモリ | 35,928 KB |
| 最終ジャッジ日時 | 2026-04-02 22:00:06 |
| 合計ジャッジ時間 | 2,817 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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