結果

問題 No.3143 Colorless Green Parentheses Sleep Furiously
ユーザー 👑 p-adic
提出日時 2025-03-11 10:18:57
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 279 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 82,900 KB
実行使用メモリ 264,092 KB
最終ジャッジ日時 2025-05-17 00:19:53
合計ジャッジ時間 27,214 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 44 WA * 1 TLE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

I,O=input,print
N,K=map(int,I().split())
b=d=p=0
E=""
for c in I():
	if c<')':
		d+=1;K-=1
		if E and E[-1]==')':E+="+(1+"
		else:E+="(1+"
	else:
		d-=1;b|=d<0;p+=d==0
		if E and E[-1]=='+':E+="1)";K-=1
		else:E+=")"
if K<0 or b|d|(K==0and p==1):exit(O("No"))
O("Yes\n"+E+"+1"*K)
0