結果
| 問題 |
No.2820 Non-Preferred IUPAC Nomenclature
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-26 22:31:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 992 bytes |
| コンパイル時間 | 5,007 ms |
| コンパイル使用メモリ | 310,556 KB |
| 実行使用メモリ | 7,896 KB |
| 最終ジャッジ日時 | 2024-07-26 22:31:43 |
| 合計ジャッジ時間 | 7,912 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 OLE * 1 |
| other | -- * 22 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using mint = atcoder::static_modint<998244353>;
//using mint = atcoder::static_modint<1000000007>;
using namespace std;
using namespace atcoder;
using ld = long double;
using ll = long long;
#define mp(a,b) make_pair(a,b)
#define rep(i,s,n) for(int i=s; i<n; i++)
const vector<int> dx{1,0,-1,0},dy{0,1,0,-1};
vector<vector<int>> G(200000);
string methyl="methyl";
void dfs(int x,int p){
for(auto y:G[x])if(y!=p){
cout << '(';
dfs(y,x);
cout << ')';
}
if(x==0)cout<<"methane";
else cout << methyl;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
rep(i,0,n){
char c;
rep(j,0,4){
cin >> c;
if(c!='H'){
G[i].push_back(c-'1');
}
}
}
// rep(i,0,n){
// cout << i << "\n";
// for(auto x:G[i])cout << x << " ";
// cout <<"\n";
// }
dfs(0,-1);
}