problem statement is here
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
int t;
scanf("%d\n",&t);
while(t--)
{
int n,i;
scanf("%d\n",&n);
long long int a,b;
scanf("%lld",&a);
char ar[1000000],br[1000000];
for(i=1;i<n;i++){
scanf("%lld",&b);
if(b>a){
ar[i-1]='G';
}else if(b==a){
ar[i-1]='E';
}else{
ar[i-1]='L';
}
a=b;
}
ar[n]='\0';
scanf("%s",br);
if(strstr(ar,br))
printf("YES\n");
else
printf("NO\n");
}
return 0;
}
No comments:
Post a Comment