結果
問題 | No.2820 Non-Preferred IUPAC Nomenclature |
ユーザー |
![]() |
提出日時 | 2024-07-26 22:31:48 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 618 bytes |
コンパイル時間 | 2,271 ms |
コンパイル使用メモリ | 207,880 KB |
実行使用メモリ | 28,660 KB |
最終ジャッジ日時 | 2024-07-26 22:31:54 |
合計ジャッジ時間 | 5,878 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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"; 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; }