結果

問題 No.1192 半部分列
ユーザー definedefine
提出日時 2020-08-05 15:07:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,280 bytes
コンパイル時間 2,281 ms
コンパイル使用メモリ 210,132 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 02:10:59
合計ジャッジ時間 4,684 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 4 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 WA -
testcase_24 AC 3 ms
4,348 KB
testcase_25 AC 4 ms
4,348 KB
testcase_26 AC 4 ms
4,348 KB
testcase_27 AC 4 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

string S,T;
void solvesmall(){
	set<string>setS,setT;
    rep(i,1<<len(S)){
        string now;
        rep(j,len(S)){
            if(i>>j&1)now+=S[j];
        }
        setS.insert(now);
    }
    rep(i,1<<len(T)){
        string now;
        rep(j,len(T)){
            if(i>>j&1)now+=T[j];
        }
        setT.insert(now);
    }
    for(string s:setS){
        if(setT.find(s)==setT.end()){
            cout<<s<<endl;return;
        }
    }
    cout<<"-1"<<endl;
}
signed main(){
	cin>>S>>T;
	assert(len(S)<=100000&&len(T)<=100000);
	if(len(S)<=18&&len(T)<=18)solvesmall();
	else {
		int cnt1=0,cnt2=0;
		rep(i,len(S))cnt1+=S[i]=='a';
		rep(i,len(T))cnt2+=S[i]=='a';
		if(cnt1<=cnt2){
			cout<<"-1"<<endl;
		}else {
			rep(i,cnt2+1)cout<<'a';
			cout<<endl;
		}
	}
}
0