結果
| 問題 |
No.69 文字を自由に並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-10 22:46:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 707 bytes |
| コンパイル時間 | 713 ms |
| コンパイル使用メモリ | 58,440 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 07:03:32 |
| 合計ジャッジ時間 | 1,189 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char const* argv[]) {
string a, b;
cin >> a >> b;
bool a_eq_b_flag = true;
string::iterator a_itr = a.begin();
for (int i = 0; i < b.size(); i++) {
string::iterator a_judge = find(a_itr, a.end(), b[i]);
if (a_judge == a.end()) {
a_eq_b_flag = false;
break;
} else {
char tmp;
tmp = a[i];
a[i] = *a_judge;
*a_judge = tmp;
a_itr++;
}
}
if (a_eq_b_flag) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
return 0;
}