F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

GT and strings

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 639    Accepted Submission(s): 155


Problem Description
You are given $N$ strings.Their total length is $L$.

There are $Q$ questions.

For each question please work out two tasks:

¢Ùwhether $S_x$ is a subsequence of $S_y$.

¢Úwhether $S_x$ is a substring of $S_y$.

If the statement is true print $1$,otherwise print $0$
 

Input
In the first line there is the testcase $T$.

For each teatcase:

In the first line there are two numbers $N$ and $Q$.

In the next $N$ lines there are $N$ strings $i$-th line is a string standing for $S_i$.

**Note that $S_i$ consists of only lower alphabets.**

In the last $Q$ lines there are two numbers$ (x,y)$.

$T \leq 5$¡£$N,L,Q \leq 100000$¡£Every string's length is at least $1$¡£

There are $60\%$ testcases that $L \leq 100$£¬$Q \leq 1000$¡£

You'd better print the enter in the last line when you hack others.

You'd better not print space in the last of each line when you hack others.
 

Output
For each testcase,print only one lines.

It's a string contains only $0$ and $1$ and its length is $Q*2$.

$i*2-1$-th character is the answer of the $i$-th question of ¢Ù£¬

and $i*2$-th character is the answer of the $i$-th question of ¢Ú¡£
 

Sample Input
1 6 6 orz stilwell skydec se dec orz 1 2 1 3 1 6 4 1 4 2 6 1
 

Sample Output
000011001011
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-03 19:09:45, Gzip enabled