結果
| 問題 | No.52 よくある文字列の問題 |
| コンテスト | |
| ユーザー |
springroll
|
| 提出日時 | 2018-11-18 16:48:36 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 641µs | |
| コード長 | 655 bytes |
| 記録 | |
| コンパイル時間 | 983 ms |
| コンパイル使用メモリ | 192,740 KB |
| 実行使用メモリ | 9,800 KB |
| 最終ジャッジ日時 | 2026-09-02 05:25:11 |
| 合計ジャッジ時間 | 2,196 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main() {
string s;
cin >> s;
int n = s.length();
set<string> strs;
list<char> chs;
for (int i = 0; i < n; i++) {
chs.push_back(s[i]);
}
for (int bit = 0; bit < (1 << n); bit++) {
list<char> tmp_chs=chs;
string str;
for (int i = 0; i < n; i++) {
if (bit&(1 << i)) {
str.push_back(tmp_chs.back());
tmp_chs.pop_back();
}
else {
str.push_back(tmp_chs.front());
tmp_chs.pop_front();
}
}
//cout <<" "<< str << endl;
strs.insert(str);
}
for (auto itr = strs.begin(); itr != strs.end(); itr++) {
//cout << *itr << endl;
}
cout << strs.size() << endl;
}
springroll