【链接】 我是链接,点我呀:)

【题意】

在这里输入题意

【题解】

用map > dic;模拟就好。
后缀。翻转一下就变成前缀了。
两重循环剔除这种情况不输出就好。

【代码】

/*
1.Shoud it use long long ?
2.Have you ever test several sample(at least therr) yourself?
3.Can you promise that the solution is right? At least,the main ideal
4.use the puts("") or putchar() or printf and such things?
5.init the used array or any value?
6.use error MAX_VALUE?
7.use scanf instead of cin/cout?
8.whatch out the detail input require
*/
#include <bits/stdc++.h>
using namespace std; map <string,vector <string> > dic; int main(){
#ifdef LOCAL_DEFINE
freopen("rush_in.txt", "r", stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
int T;
cin >> T;
while (T--){
string s;
cin >> s;
int num;
cin >> num;
for (int i = 1;i <= num;i++){
string ts;
cin >> ts;
reverse(ts.begin(),ts.end());
dic[s].push_back(ts);
}
}
cout << dic.size() << endl;
for (auto temp:dic){
vector<string> v = temp.second;
for (int i = 0;i < (int) v.size();i++)
for (int j = 0;j <(int) v.size()-1;j++){
if ((int)v[j].size()>(int)v[j+1].size()){
swap(v[j],v[j+1]);
}
}
set <int> myset;myset.clear();
int len = v.size();
for (int i = 0;i < len;i++)
for (int j = i+1;j < len;j++){
int tlen = v[i].size();
if (v[i]==v[j].substr(0,tlen)){
myset.insert(i);
}
}
cout << temp.first<<' '<<len - (int)myset.size();
for (int i = 0;i < len;i++){
if (myset.count(i)==0){
reverse(v[i].begin(),v[i].end());
cout <<' '<<v[i];
}
}
cout << endl;
} return 0;
}

【Codeforces Round #451 (Div. 2) C】Phone Numbers的更多相关文章

  1. 【Codeforces Round #451 (Div. 2) A】Rounding

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 模拟 [代码] /* 1.Shoud it use long long ? 2.Have you ever test several ...

  2. 【Codeforces Round #451 (Div. 2) B】Proper Nutrition

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 可以直接一层循环枚举. 也可以像我这样用一个数组来存y*b有哪些. 当然.感觉这样做写麻烦了.. [代码] /* 1.Shoud i ...

  3. 【Codeforces Round #451 (Div. 2) D】Alarm Clock

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 尺取法+二分. 类似滑动窗口. 即左端点为l,右端点为r. 维护a[r]-a[l]+1总是小于等于m的就好. (大于m就右移左端点) ...

  4. 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers

    [链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...

  5. 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes

    [题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...

  6. 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees

    [题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...

  7. 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory

    [题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...

  8. 【Codeforces Round #423 (Div. 2) C】String Reconstruction

    [Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...

  9. 【Codeforces Round #423 (Div. 2) B】Black Square

    [Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...

随机推荐

  1. linux和unix的对照

    在之前的博客中说到,linux是一个单一内核的操作系统,但它与传统的单一内核UNIX操作系统不同. 在普通单一内核系统中,全部内核代码都是被静态编译和链接的. 而在linux中,能够动态的装入和卸载内 ...

  2. vue14 自定义过滤器

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. Gym - 100625E Encoded Coordinates 矩阵快速幂

    题意: 一直TLE我也是醉了,,不爽! #include <iostream> #include <cstdio> #include <fstream> #incl ...

  4. 水 hdu5208 2015-04-20 21:03 36人阅读 评论(0) 收藏

    题意: 选择数列中两个数,使得最大公约数最大 分析: 类似筛选法,因为数值不大,可以用b[i]计算i是多少个数的因子.最后取最大的i即可. #include <bits/stdc++.h> ...

  5. 国行Android手机使用google全套GMS服务小结

        由于众所周知的原因,国行手机是不能内置google服务的,但作为铁杆google粉,没有GMS的Android不是完整的Android,NEXUS系列机器又由于各种原因买不到或者不想选购,那么 ...

  6. Django_shell命令操作

  7. Linux 桌面玩家指南:18. 我对 Docker 的使用的学习心得

    原文:Linux 桌面玩家指南:18. 我对 Docker 的使用的学习心得 特别说明:要在我的随笔后写评论的小伙伴们请注意了,我的博客开启了 MathJax 数学公式支持,MathJax 使用$标记 ...

  8. Swift学习笔记(2)--元组(Tuples)、Optional(可选值)、(Assertions)断言

    1.Tuples(元组) 元组是多个值组合而成的复合值.元组中的值可以是任意类型,而且每一个元素的类型可以是不同的. 1>定义:使用()包含所有元素,用逗号分开,也可以对每个元素做命名 let ...

  9. 【Uva 10618】Tango Tango Insurrection

    [Link]: [Description] 玩跳舞机. 有一定的约束. 归纳起来就是以下三点 1.两只脚不能同时踩一个位置 2.如果左脚踩在了右键上,那么下一次移动的一定要是左脚 3.如果右脚踩在了左 ...

  10. 记VS2008初始化Microsoft Visual Sourcesafe源码管理提供程序时失败

    之前vs2008开发一直都好好,不知道为什么如今的vs2008打开和关闭都老是弹出这这个初始化Microsoft Visual Sourcesafe源码管理提供程序时失败的错误 解决方法非常easy: ...