MSBOP 2015 Round2B register

Ended

Participants:6187

Verdict:AC | TLE
Submitted:2015-04-26 14:10:05

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
using namespace std;
string str[100];
int main()
{
    int t;
    cin>>t;
    for(int ti=1;ti<=t;ti++)
    {
        int n;
        cin>>n;
        for(int i=0;i<n;i++)
        {
            cin>>str[i];
        }
        sort(str,str+n);
        int cnt=0;
        do
        {
            bool flag=true;
            for(int i=0;i<n-1&&flag;i++)
            {
                if(str[i][0]==str[i+1][0])
                {
                    flag=false;
                }
            }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX