結果
| 問題 | No.2820 Non-Preferred IUPAC Nomenclature |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-26 21:37:22 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 98 ms / 2,000 ms |
| + 356µs | |
| コード長 | 725 bytes |
| 記録 | |
| コンパイル時間 | 1,307 ms |
| コンパイル使用メモリ | 223,212 KB |
| 実行使用メモリ | 17,196 KB |
| 最終ジャッジ日時 | 2026-11-01 19:11:19 |
| 合計ジャッジ時間 | 7,414 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge7_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<vector<int>> Graph(N);
for(int i=0; i<N; i++){
for(int k=0; k<4; k++){
string s; cin >> s;
if(s == "H") continue;
int u = stoi(s)-1;
Graph.at(u).push_back(i);
}
}
auto dfs = [&](auto dfs,int pos,int back) -> void {
for(auto to : Graph.at(pos)){
if(to == back) continue;
cout << "(";
dfs(dfs,to,pos);
cout << ")";
}
if(back == -1) cout << "methane\n";
else cout << "methyl";
};
dfs(dfs,0,-1);
}