結果
| 問題 | 
                            No.2168 双頭ヒドラゲーム
                             | 
                    
| コンテスト | |
| ユーザー | 
                             maspy
                         | 
                    
| 提出日時 | 2022-12-20 16:48:42 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 595 bytes | 
| コンパイル時間 | 105 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-11-18 01:54:09 | 
| 合計ジャッジ時間 | 1,835 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 15 WA * 9 | 
ソースコード
S = input()
T = input()
def parse(S, p=0):
    if p == len(S) or S[p] != "(":
        return p, 0
    assert S[p] == "("
    p += 1
    p, a = parse(S, p)
    assert S[p] == "|"
    p += 1
    p, b = parse(S, p)
    assert S[p] == ")"
    p += 1
    p, c = parse(S, p)
    return p, (a, b, c)
def compare(S, T):
    if S == 0:
        return 1
    if T == 0:
        return 0
    if S[0] == T[0] and S[1] == T[1]:
        return compare(S[2], T[2])
    if S[0] == T[0]:
        return compare(S[1], T[1])
    return compare(S[0], T[0])
S = parse(S)[1]
T = parse(T)[1]
print(compare(S, T))
            
            
            
        
            
maspy