結果
問題 | No.22 括弧の対応 |
ユーザー |
![]() |
提出日時 | 2016-06-19 12:31:51 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 216 bytes |
コンパイル時間 | 104 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-20 07:13:54 |
合計ジャッジ時間 | 1,532 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)