Problem - C - Codeforces
题意:
Code:
#include <bits/stdc++.h>
//#define int long long
using namespace std;
const int mxn=3e5+10;
const int mxe=1e5+10;
const int mod=1e9+7;
const int Inf=0x3f3f3f3f;
string s,l,r;
int M;
void solve(){
s.clear();
l.clear();
r.clear();
cin>>s>>M>>l>>r;
int p=0;
for(int i=0;i<M;i++){
int q=p;
for(char x=l[i];x<=r[i];x++){
if(s.find(x,p)==-1){
cout<<"YES"<<'\n';
return;
}
q=max(q,int(s.find(x,p))+1);
}
p=q;
}
cout<<"NO"<<'\n';
}
signed main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int __=1;cin>>__;
while(__--)solve();return 0;
}