結果
問題 |
No.170 スワップ文字列(Easy)
|
ユーザー |
|
提出日時 | 2021-01-06 23:20:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 5,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 1,891 ms |
コンパイル使用メモリ | 177,552 KB |
実行使用メモリ | 6,656 KB |
最終ジャッジ日時 | 2024-11-07 12:21:50 |
合計ジャッジ時間 | 3,049 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } signed main(){ string s; cin >> s; vector<int> a; for(int i = 0;i < s.size();i++) a.push_back(i); set<string> st; do{ string t = ""; for(auto i : a){ t += s[i]; } st.insert(t); }while(next_permutation(a.begin(), a.end())); st.erase(s); cout << st.size() << endl; return 0; }