結果
問題 |
No.2398 ヒドラ崩し
|
ユーザー |
![]() |
提出日時 | 2025-06-12 12:50:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 483 bytes |
コンパイル時間 | 201 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 62,592 KB |
最終ジャッジ日時 | 2025-06-12 12:50:34 |
合計ジャッジ時間 | 2,471 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)