結果
| 問題 | 
                            No.2398 ヒドラ崩し
                             | 
                    
| コンテスト | |
| ユーザー | 
                             gew1fw
                         | 
                    
| 提出日時 | 2025-06-12 19:42:50 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 505 bytes | 
| コンパイル時間 | 163 ms | 
| コンパイル使用メモリ | 82,444 KB | 
| 実行使用メモリ | 61,320 KB | 
| 最終ジャッジ日時 | 2025-06-12 19:42:52 | 
| 合計ジャッジ時間 | 2,145 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 21 WA * 10 | 
ソースコード
H = input().strip()
max_depth = 0
count = 0
current_depth = 0
i = 0
n = len(H)
while i < n:
    if H[i] == '(' and i + 1 < n and H[i+1] == ')':
        depth = current_depth
        if depth > max_depth:
            max_depth = depth
            count = 1
        elif depth == max_depth:
            count += 1
        i += 2
    else:
        if H[i] == '(':
            current_depth += 1
        else:
            current_depth -= 1
        i += 1
if count % 2 == 1:
    print(0)
else:
    print(1)
            
            
            
        
            
gew1fw