結果
| 問題 |
No.2820 Non-Preferred IUPAC Nomenclature
|
| コンテスト | |
| ユーザー |
kokosei
|
| 提出日時 | 2024-07-27 09:12:38 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 108 ms / 2,000 ms |
| コード長 | 726 bytes |
| コンパイル時間 | 1,153 ms |
| コンパイル使用メモリ | 89,780 KB |
| 実行使用メモリ | 22,340 KB |
| 最終ジャッジ日時 | 2024-07-27 09:12:45 |
| 合計ジャッジ時間 | 6,491 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int N;
vector<int> G[202020];
void dfs(int v, int p, string& ans){
for(int nv : G[v]){
if(nv == p)continue;
ans += "(";
dfs(nv, v, ans);
ans.erase(ans.end() - 3, ans.end());
ans += "yl)";
}
ans += "methane";
}
int main(void){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N;
for(int i = 0;i < N;i++){
for(int j = 0;j < 4;j++){
string c; cin >> c;
if(c == "H")continue;
int v = stoi(c) - 1;
G[i].push_back(v);
}
}
string ans = "";
dfs(0, -1, ans);
cout << ans << endl;
return 0;
}
kokosei