結果
| 問題 |
No.2820 Non-Preferred IUPAC Nomenclature
|
| コンテスト | |
| ユーザー |
みどりむし🦠
|
| 提出日時 | 2024-04-04 22:17:42 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 109 ms / 2,000 ms |
| コード長 | 956 bytes |
| コンパイル時間 | 1,074 ms |
| コンパイル使用メモリ | 103,640 KB |
| 実行使用メモリ | 25,260 KB |
| 最終ジャッジ日時 | 2024-07-26 16:27:11 |
| 合計ジャッジ時間 | 5,900 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <cstdint>
#include <iostream>
#include <ranges>
#include <vector>
#include <string>
#include <array>
void solve() {
int n; std::cin >> n;
std::vector<std::vector<int>> tree(n);
for(const int i : std::views::iota(0, n)) {
for([[maybe_unused]] const int _ : std::views::iota(0, 4)) {
std::string c; std::cin >> c;
if(c == "H") continue;
tree[i].emplace_back(std::stoi(c) - 1);
}
}
std::string ans;
auto dfs = [&](auto&& dfs, int v, int p) -> void {
for(const int nv : tree[v]) {
if(nv < 0 || nv == p) continue;
ans += "(";
dfs(dfs, nv, v);
ans += "yl)";
}
ans += "meth";
};
dfs(dfs, 0, -1);
std::cout << ans + "ane" << "\n";
}
int main() {
solve();
return 0;
}
__attribute__((constructor)) inline void fast_io() { std::ios::sync_with_stdio(false), std::cin.tie(nullptr); }
みどりむし🦠