Problem - C - Codeforces
题意:
Code:
文章来源:https://uudwc.com/A/nJpX0
#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;
}
文章来源地址https://uudwc.com/A/nJpX0