結果
| 問題 | No.22 括弧の対応 |
| コンテスト | |
| ユーザー |
a_ten
|
| 提出日時 | 2016-03-15 19:59:44 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 384 bytes |
| 記録 | |
| コンパイル時間 | 293 ms |
| コンパイル使用メモリ | 77,632 KB |
| 最終ジャッジ日時 | 2025-12-03 19:50:03 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 7 |
ソースコード
#coding:utf-8 N,K=map(int,raw_input().split()) S=raw_input() cnt_l,ans_l=0,0 cnt_r,ans_r=0,0 if K <= len(S)/2: for i in S[K-1:]: cnt_l+=1 if i == S[K-1]: ans_l+=1 else: ans_l-=1 if ans_l == 0: print cnt_l+(K-1) break else: for i in S[:K][::-1]: cnt_r+=1 if i == S[K-1]: ans_r+=1 else: ans_r-=1 if ans_r == 0: print cnt_r-(K-1) break
a_ten