結果
問題 |
No.2820 Non-Preferred IUPAC Nomenclature
|
ユーザー |
![]() |
提出日時 | 2024-07-26 22:18:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 599 bytes |
コンパイル時間 | 1,944 ms |
コンパイル使用メモリ | 199,732 KB |
最終ジャッジ日時 | 2025-02-23 18:43:22 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | TLE * 1 -- * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; vector<vector<int>> G; string dfs(int const u, int const p) { string ret; for (int const v : G[u]) if (v != p) { string sub{dfs(v, u)}; 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, -1) << endl; }