結果
問題 |
No.2820 Non-Preferred IUPAC Nomenclature
|
ユーザー |
![]() |
提出日時 | 2024-07-26 22:30:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 2,121 ms |
コンパイル使用メモリ | 199,956 KB |
最終ジャッジ日時 | 2025-02-23 18:46:59 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | TLE * 1 -- * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; vector<vector<int>> G; bool vis[200000]; string dfs(int const u) { vis[u] = true; string ret; for (int const v : G[u]) if (not vis[v]) { string sub{dfs(v)}; for (int i=0; i < 3; ++i) sub.pop_back(); ret += "(" + sub + "yl)"; } ret += "methane"; fprintf(stderr, "dfs(%d) -> %s\n", u, ret.c_str()); return ret; } int main() { int N; cin >> N; G.resize(N); for (int u=0; u < N; ++u) for (int i=0; i < 4; ++i) { string C; cin >> C; if (C != "H") { int const v{stoi(C) - 1}; G[u].push_back(v); } } cout << dfs(0) << endl; }