結果

問題 No.2820 Non-Preferred IUPAC Nomenclature
ユーザー nikoro256
提出日時 2024-07-26 22:21:26
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 565 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 134,032 KB
最終ジャッジ日時 2024-07-26 22:21:31
合計ジャッジ時間 4,487 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 RE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N = int(input())
C = []
for _ in range(N):
    C_d = list(map(str, input().split()))
    C.append(C_d)

ans = deque()


def dfs(parent, pos):
    global ans
    for e in C[pos]:
        if e != "H" and e != str(parent + 1):
            e = int(e) - 1
            ans.append("(")
            dfs(pos, e)
            for i in range(3):
                ans.pop()
            ans.append("y")
            ans.append("l")
            ans.append(")")
    for s in "methane":
        ans.append(s)
    return


dfs(-1, 0)
print("".join(ans))
0