結果
問題 | No.52 よくある文字列の問題 |
ユーザー |
![]() |
提出日時 | 2019-07-20 23:18:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 540 bytes |
コンパイル時間 | 935 ms |
コンパイル使用メモリ | 84,200 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-31 00:26:32 |
合計ジャッジ時間 | 1,683 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <algorithm> #include <iostream> #include <vector> #include <set> #include <deque> using namespace std; int main() { string s; cin >> s; int n = s.length(); set<string> res; for (int i = 0; i < 1 << n; i++) { deque<char> deq(s.begin(), s.end()); string t = ""; for (int j = 0; j < n; j++) { if (i >> j & 1) t += deq.front(), deq.pop_front(); else t += deq.back(), deq.pop_back(); } res.emplace(t); } cout << res.size() << endl; return 0; }