結果

問題 No.2820 Non-Preferred IUPAC Nomenclature
ユーザー Nichi10p
提出日時 2024-07-27 06:50:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 245 ms / 2,000 ms
コード長 569 bytes
コンパイル時間 2,490 ms
コンパイル使用メモリ 197,736 KB
最終ジャッジ日時 2025-02-23 19:02:57
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/hana/functional/fix.hpp>
using boost::hana::fix;

int main() {
  int N;
  cin >> N;
  vector<vector<int>> G(N);
  for (int u=0; u < N; ++u)
    for (int i=0; i < 4; ++i) {
      string C;
      cin >> C;
      if (C != "H")
        G[u].push_back(stoi(C) - 1);
    }

  fix([&](auto &&self, int const u, int const p) -> void {
    for (int const v : G[u])
      if (v != p) {
        cout << "(";
        self(v, u);
        cout << "yl)";
      }
    cout << "meth";
  })(0, -1);
  cout << "ane" << endl;
}
0