結果
| 問題 |
No.3143 Colorless Green Parentheses Sleep Furiously
|
| コンテスト | |
| ユーザー |
回転
|
| 提出日時 | 2025-05-16 21:53:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 764 bytes |
| コンパイル時間 | 269 ms |
| コンパイル使用メモリ | 82,460 KB |
| 実行使用メモリ | 56,668 KB |
| 最終ジャッジ日時 | 2025-05-17 00:25:38 |
| 合計ジャッジ時間 | 7,488 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 19 WA * 30 |
ソースコード
N,K = list(map(int,input().split()))
S = input()
from random import randint
N,K = randint(1,20),randint(1,20)
S = "".join(["()"[randint(0,1)] for _ in range(N)])
ans = []
stack = []
for i in S:
if(i == "("):
stack.append("(")
if(ans and ans[-1][-1] == ")"):ans.append("+")
ans.append("(1+")
else:
if(stack):
if(ans and ans[-1][-1] != "+"):
ans.append(")")
else:
ans.append("1)")
stack.pop()
else:
print("No")
exit()
if(stack):
print("No")
exit()
anss = "".join(ans)
try:
if(eval(anss) <= K):
print("Yes")
print(anss + "+1"*(K-eval(anss)))
else:
print("No")
except:
print("No")
回転