-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcp126.cpp
More file actions
40 lines (36 loc) · 677 Bytes
/
Copy pathcp126.cpp
File metadata and controls
40 lines (36 loc) · 677 Bytes
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
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
string s;
cin >> s;
string s1 = s.substr(0,n);
string s2 = s.substr(n,n);
sort(s1.begin(), s1.end());
sort(s2.begin(), s2.end());
int flag = 0;
if(s1 > s2){
for(int i=0; i<n; i++){
if(s1[i] <= s2[i]){
flag = 1;
break;
}
}
}
else{
for(int i=0; i<n; i++){
if(s1[i] >= s2[i]){
flag = 1;
break;
}
}
}
if(flag == 1){
cout << "NO" << endl;
}
else{
cout << "YES" << endl;
}
return 0;
}