結果
問題 |
No.3143 Colorless Green Parentheses Sleep Furiously
|
ユーザー |
|
提出日時 | 2025-05-16 21:59:51 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 287 bytes |
コンパイル時間 | 419 ms |
コンパイル使用メモリ | 82,016 KB |
実行使用メモリ | 169,516 KB |
最終ジャッジ日時 | 2025-05-17 00:27:27 |
合計ジャッジ時間 | 10,317 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 WA * 2 RE * 6 |
ソースコード
n,k=map(int,input().split()) s=input() t=s q=[] ans=0 for c in s: q+=c, if q[-2:]==[*'()']: q.pop() q.pop() if q: exit(print('No')) t=t.replace('()','(1)') t=t.replace('(','(1+') t=t.replace(')(',')+(') s=eval(t) if s>k: exit(print('No')) print('Yes') print(t+'+1'*(k-s))