/ SeriousOJ /

Record Detail

Accepted


  

Code

#include<bits/stdc++.h>
#define nl '\n'
using namespace std;

void solve(){
	int n;cin>>n;
	string a,b,s;cin>>a>>b;
	char c='a';
	for(int i=0;i<a.size();i++){
		if(c<=min(a[i],b[i])){
			c=min(a[i],b[i]);
		}
		else if(c<=max(a[i],b[i])){
          c=max(a[i],b[i]);
		}
		else {
			cout<<"No\n";
			return;
		}
			// cout<<c<<nl;
	}
	cout<<"Yes\n";
}

int main(){
	int T;cin>>T;
	for(int tc = 1; tc <= T; tc++){
		solve();
	}
}

Information

Submit By
Type
Pretest
Problem
P1117 String Sorted
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-07 10:37:35
Judged At
2024-12-07 10:37:35
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes