結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
ebicochineal
|
| 提出日時 | 2016-06-19 12:31:51 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 5,000 ms |
| + 685µs | |
| コード長 | 216 bytes |
| 記録 | |
| コンパイル時間 | 288 ms |
| コンパイル使用メモリ | 21,540 KB |
| 実行使用メモリ | 15,868 KB |
| 最終ジャッジ日時 | 2026-08-19 17:19:30 |
| 合計ジャッジ時間 | 3,827 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
ソースコード
N, M = map(int, input().split())
S = input()
d = c = a = 1
if S[M-1] == ")" : d = -1
while 1:
if S[M-1 + c * d] == S[M-1]:
a += 1
else:
a -= 1
if a == 0 : break
c += 1
print(M + c * d)
ebicochineal