結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-10 17:35:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 5,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 1,076 ms |
| コンパイル使用メモリ | 82,908 KB |
| 実行使用メモリ | 5,456 KB |
| 最終ジャッジ日時 | 2024-09-16 15:55:30 |
| 合計ジャッジ時間 | 1,936 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main() {
int ans = 0;
string s;
vector<string> tmp;
cin >> s;
sort(s.begin(), s.end());
tmp.push_back(s);
while (next_permutation(s.begin(), s.end())) tmp.push_back(s);
sort(tmp.begin(), tmp.end());
for (size_t i = 1; i < tmp.size(); ++i) if (tmp[i - 1] != tmp[i]) ++ans;
cout << ans;
}