Chef and his Sequence
All submissions for this problem are available.
Chef has a sequence of N numbers. He like a sequence better if the sequence contains his favorite sequence as a substring.
Given the sequence and his favorite sequence(F) check whether the favorite sequence is contained in the sequence
The first line will contain the number of test cases and are followed by the cases.
Each test case consists of four lines: The length of the sequence, the sequence N,the length of F and the sequence F
Print "Yes" if the sequence contains the favourite sequence int it otherwise print "No"
Input: 2 6 1 2 3 4 5 6 3 2 3 4 6 22 5 6 33 1 4 2 4 15
Output: Yes No
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.