結果
| 問題 |
No.52 よくある文字列の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-06 03:07:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,324 bytes |
| コンパイル時間 | 661 ms |
| コンパイル使用メモリ | 77,304 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 13:51:12 |
| 合計ジャッジ時間 | 1,149 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <utility>
#include <set>
#include <list>
using namespace std;
using ll = long long int;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL_INCLUDED_ENVIRONMENT
template <class T> std::ostream& operator<<(std::ostream& o, const std::vector<T>& v) {
o << "{";
for (int i = 0; i < (int) v.size(); i++)
o << (i > 0 ? ", " : "" ) << v[i];
o << "}";
return o;
}
template <class T> std::ostream& operator<<(std::ostream& o, const std::list<T>& lst) {
o << "{";
for (auto itr = lst.begin(); itr != lst.end(); itr++)
o << (itr == lst.begin() ? "" : ", " ) << *itr;
o << "}";
return o;
}
template <class X, class Y> std::ostream& operator<<(std::ostream& o, const std::pair<X, Y>& p) {
o << "(" << p.first << ", " << p.second << ")";
return o;
}
int main() {
// cin.tie(0);
// ios::sync_with_stdio(false);
string s;
cin >> s;
set<string> table;
int n = s.size();
string key(n, ' ');
REP(bits, 1 << n) {
string::iterator l = s.begin();
string::iterator r = s.end(); r--;
REP(i, n) {
if (bits & (1 << i)) {
key[i] = *l;
l++;
} else {
key[i] = *r;
r--;
}
}
// cout << lst << "\n";
table.insert(key);
}
cout << table.size() << "\n";
return 0;
}