結果
問題 |
No.3143 Colorless Green Parentheses Sleep Furiously
|
ユーザー |
![]() |
提出日時 | 2025-05-28 10:49:27 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 521 bytes |
コンパイル時間 | 601 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2025-05-28 10:49:33 |
合計ジャッジ時間 | 5,828 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 42 WA * 4 RE * 3 |
ソースコード
def main(): n, k = map(int, input().split()) s = input() t = "" c = 0 for i in range(n): if s[i] == '(': if i > 0 and t[-1] == ')': t += '+' t += s[i] if s[i] == ')': if i == 0: c = 100001 break if t[-1] == '(': t += '1+1' c += 2 else: t += '+1' c += 1 t += s[i] if t[-1] == '(': c = 100001 while c < k: t += '+1' c+= 1 if k == c: print("Yes") print(t) else: print("No") main()