結果
| 問題 |
No.3140 Weird Parentheses Game
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-05-16 21:51:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 303 bytes |
| コンパイル時間 | 712 ms |
| コンパイル使用メモリ | 82,572 KB |
| 実行使用メモリ | 54,124 KB |
| 最終ジャッジ日時 | 2025-05-16 21:51:48 |
| 合計ジャッジ時間 | 1,997 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 21 |
ソースコード
N = int(input())
S = input()
def is_balanced(s: str) -> bool:
d = 0
for c in S:
if c == '(':
d += 1
elif c == ')':
if d == 0:
return False
d -= 1
return d == 0
if is_balanced(S):
print('Yes')
else:
print('No')
norioc