結果

問題 No.22 括弧の対応
ユーザー roiti46roiti46
提出日時 2015-02-09 21:53:31
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 234 bytes
コンパイル時間 87 ms
コンパイル使用メモリ 6,616 KB
実行使用メモリ 6,260 KB
最終ジャッジ日時 2023-09-05 21:17:52
合計ジャッジ時間 1,265 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,012 KB
testcase_01 AC 11 ms
6,028 KB
testcase_02 AC 11 ms
5,856 KB
testcase_03 AC 12 ms
6,260 KB
testcase_04 AC 12 ms
6,084 KB
testcase_05 AC 12 ms
5,920 KB
testcase_06 AC 12 ms
6,084 KB
testcase_07 WA -
testcase_08 AC 11 ms
6,032 KB
testcase_09 WA -
testcase_10 AC 11 ms
6,220 KB
testcase_11 AC 11 ms
5,956 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 11 ms
6,248 KB
testcase_16 AC 11 ms
6,160 KB
testcase_17 AC 11 ms
5,880 KB
testcase_18 AC 11 ms
5,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,raw_input().split())
s = raw_input()
for R in [range(K-1,N),range(K)[::-1]]:
    a = 0
    for i in R:
        a += 1 if s[i] == "(" else -1
        if a == 0:
            print i+1
            break
    if a == 0: break
0