結果
| 問題 |
No.69 文字を自由に並び替え
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-30 09:05:49 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 735 bytes |
| コンパイル時間 | 765 ms |
| コンパイル使用メモリ | 86,984 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-30 09:05:52 |
| 合計ジャッジ時間 | 1,411 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 |
ソースコード
#include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, d, n) for (int i = d; i < (int)(n); i++)
#define forEach(arr) for (auto& it:arr)
int main(void){
string a,b;
cin >> a >> b;
int al = a.length();
map<char,int>m;
rep(i,al) {
m[a[i]] = 0;
}
rep(i,al) {
m[b[i]] = 0;
}
rep(i,al) {
m[a[i]] += 1;
}
// rep(i,al) {
// m[b[i]] = true;
// }
rep(i,al) {
m[b[i]] -= 1;
if(m[b[i]] < 0) {
cout << "NO";
return 0;
}
}
cout << "YES";
}