#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
int T, n;
string s[900005];
map<string, int>mm;//存放每一个字符串是否出现过
int main()
{
cin >> T;
while (T--){
mm.clear();//每次清空 mm里面的数值防止混乱
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s[i];
mm[s[i]] = 1;
}
for (int i = 0; i < n; i++)
{
int aa = 0;
for (int j = 1; j < s[i].size(); j++) {
string s1 = s[i].substr(0, j);//前面的放一堆
string s2 = s[i].substr(j);//后面放一堆
if (mm[s1] && mm[s2]) {//两个部分都行
aa = 1;//标记
break;//退出循环
}
}
cout << aa;
}
cout << endl;
}
return 0;
}
标签:include,string,int,Double,++,codeforces,cin,mm,div4
From: https://blog.csdn.net/2302_80415058/article/details/137057047