結果
| 問題 |
No.52 よくある文字列の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-16 22:09:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 566 bytes |
| コンパイル時間 | 1,984 ms |
| コンパイル使用メモリ | 179,048 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-10-02 12:38:17 |
| 合計ジャッジ時間 | 2,931 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
const ll INF = 1e14;
const int MOD = 1000000007;
vector<string> ans;
string s;
void dfs(int l,int r,string now){
if(l > r){
ans.push_back(now);
}
else{
dfs(l+1,r,now + s[l]);
dfs(l,r-1,now + s[r]);
}
}
int main(){
cin >> s;
dfs(0,s.size()-1,"");
sort(ans.begin(),ans.end());
ans.erase(unique(ans.begin(),ans.end()),ans.end());
cout << ans.size() << endl;
return 0;
}