-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1228A-Distinct Digits.cpp
56 lines (47 loc) · 1.42 KB
/
1228A-Distinct Digits.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//Definition Section
//--------------------------------------------------------------
#define fl(i,x,y) for(int i=x; i<y; i++)
#define flc(i,x,y,z) for(int i=x; i<y; i+=z)
#define nl cout<<endl
#define vsort(v) sort(v.begin(), v.end());
#define vsortg(v) sort(v.begin(), v.end(), greater<int>());
#define getIntoVc(v,n) { while(n--) {long long yyy; cin>>yyy; v.push_back(yyy);}}
#define all(x) x.begin(),x.end()
#define pb push_back
#define printvc(v) for(int i=0; i<v.size(); i++) cout<<v[i]<<" ";
#define strTOint(s,n) {stringstream sst; sst<<s; sst>>n;}
#define intTOstr(n,s) {stringstream sst; sst<<n; sst>>s;}
#define ff first
#define ss second
#define DouraMama {ios::sync_with_stdio(false); cin.tie(NULL);}
#define prefixSum(v,prefix) {long long sum=0; for(int i=0; i<v.size(); i++) {sum+=v[i];prefix.push_back(sum);}}
//--------------------------------------------------------------
bool isIt(ll n) {
ll counter=0;
set<ll> st;
while(n>0) {
st.insert(n%10);
n/=10;
counter++;
}
if(st.size()==counter) return true;
else return false;
}
int main()
{ DouraMama
ll n,m,t,i,j,k,x,y,z,a,b,c,cnt=0,ans=0;
bool flag=false;
string s,s1,s2,s3;
vector<ll> v;
cin>>x>>y;
fl(i,x,y+1) {
if(isIt(i)) {
cout<<i; return 0;
}
}
cout<<-1;
//cout<<endl; main();
}