結果
問題 |
No.2820 Non-Preferred IUPAC Nomenclature
|
ユーザー |
|
提出日時 | 2024-07-26 23:01:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 2,236 ms |
コンパイル使用メモリ | 201,776 KB |
最終ジャッジ日時 | 2025-02-23 18:52:49 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | TLE * 1 -- * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; string dfs(const vector<vector<int>> &G, int v, vector<bool> &visited) { visited[v] = true; string str; for (int u : G[v]) { if (!visited[u]) { string s = dfs(G, u, visited); str += ("(" + s.substr(0, s.size() - 3) + "yl)"); } } return str + "methane"; } int main() { int n; cin >> n; vector<vector<int>> C(n); for (int i = 0; i < n; i++) { for (int j = 0; j < 4; j++) { string s; cin >> s; if (s != "H") { C[i].push_back(stoi(s) - 1); } } } vector<bool> visited(n, false); cout << dfs(C, 0, visited); return 0; }