欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1703D.Double Strings
Double Strings
You are given strings of length at most .
For each string , determine if there exist two strings and such that . That is, is the concatenation of and . Note that can be equal to .
Recall that the concatenation of strings and is , where and are the lengths of strings and respectively. For example, concatenation of "code" and "forces" is "codeforces".
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains a single integer () — the number of strings.
Then lines follow, the -th of which contains non-empty string of length at most , consisting of lowercase English letters. Among the given strings, there may be equal (duplicates).
The sum of over all test cases doesn't exceed .
Output
For each test case, output a binary string of length . The -th bit should be 1 if there exist two strings and where , and 0 otherwise. Note that can be equal to .
Note
In the first test case, we have the following:
- , since
abab} = \texttt{ab} + \texttt{ab. Remember that can be equal to . - is not the concatenation of any two strings in the list.
- , since
abc} = \texttt{ab} + \texttt{c. - is not the concatenation of any two strings in the list.
- is not the concatenation of any two strings in the list.
Since only and satisfy the conditions, only the first and third bits in the answer should be 1, so the answer is 10100.
Samples
3
5
abab
ab
abc
abacb
c
3
x
xx
xxx
8
codeforc
es
codes
cod
forc
forces
e
code
10100
011
10100101
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |