結果
問題 | No.2820 Non-Preferred IUPAC Nomenclature |
ユーザー |
|
提出日時 | 2024-07-27 00:13:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 1,078 bytes |
コンパイル時間 | 5,596 ms |
コンパイル使用メモリ | 311,200 KB |
実行使用メモリ | 18,328 KB |
最終ジャッジ日時 | 2024-07-27 00:13:19 |
合計ジャッジ時間 | 11,553 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 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 m="meth",head="(",tail="yl)"; void dfs(int x,int p){ for(auto y:G[x])if(y!=p){ cout << head; dfs(y,x); cout << tail; } cout << m; } int to_int(string s){ int p=0; for(char c:s)p*=10,p+=c-'0'; return p; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; rep(i,0,n){ string s; rep(j,0,4){ cin >> s; if(s!="H"){ G[i].push_back(to_int(s)-1); } } } // rep(i,0,n){ // cout << i << "\n"; // for(auto x:G[i])cout << x << " "; // cout <<"\n"; // } dfs(0,-1); cout << "ane"; }