結果
問題 | No.2398 ヒドラ崩し |
ユーザー |
![]() |
提出日時 | 2025-06-12 18:02:36 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 483 bytes |
コンパイル時間 | 208 ms |
コンパイル使用メモリ | 82,688 KB |
実行使用メモリ | 62,208 KB |
最終ジャッジ日時 | 2025-06-12 18:02:39 |
合計ジャッジ時間 | 2,509 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 11 |
ソースコード
def is_single_parentheses(s): if len(s) == 0: return False if s[0] != '(' or s[-1] != ')': return False balance = 0 for i, c in enumerate(s): if c == '(': balance += 1 else: balance -= 1 if balance < 0: return False if i != len(s) - 1 and balance == 0: return False return balance == 0 H = input().strip() if is_single_parentheses(H): print(0) else: print(1)