結果
問題 |
No.52 よくある文字列の問題
|
ユーザー |
![]() |
提出日時 | 2025-03-29 17:02:28 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 1,835 ms |
コンパイル使用メモリ | 169,376 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-29 17:02:31 |
合計ジャッジ時間 | 2,619 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for(int i = 0; i < n; i++) int main() { string s; cin >> s; set<string> st; function<void(string, string)> dfs = [&](string ss, string t) { if(ss.size() == 0) { st.insert(t); return; } string w = ss; w.erase(w.begin()); dfs(w, t + ss[0]); t += ss.back(); ss.pop_back(); dfs(ss, t); }; string t; dfs(s, t); cout << st.size() << endl;; }