結果

問題 No.69 文字を自由に並び替え
ユーザー HIBIKU
提出日時 2017-01-21 18:14:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 479 bytes
コンパイル時間 945 ms
コンパイル使用メモリ 69,168 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 06:27:29
合計ジャッジ時間 1,357 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
	// your code goes here
	string a,b;
	int i,j,ans=0;
	cin >>a >>b;
	vector<int>dp(a.size(),0);
	for(i = 0;i < a.size();i++){
		//cout<<a[i]<<endl;
		for(j = 0;j < b.size();j++){
			//cout<<dp[j]<<" ";
			if(dp[j]!=1){
				if(a[i]==b[j]){
					dp[j]=1;
					ans++;
					break;
				}
			}
		}
		//cout<<endl;
	}
	//cout<<ans<<endl;
	if(ans == a.size()) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}
0