General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
68273741 Contestant:
keep_trying
1287B - 68 GNU C++17 Time limit exceeded on pretest 10 3000 ms 408 KB 2020-01-05 18:47:45 2020-01-05 18:47:45
 
 
→ Source
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define test(n) for(int i=0;i<n;i++)
#define mod ((1e+9)+7)
#define N 100005
#define pb push_back
#define f(s,e,f) for(int i=s;i<=e;i+=f)
void solve()
{
    int n,k;
    cin>>n>>k;
    int c=0;
    vector<string> v;
    unordered_map<string,int> m;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        v.push_back(s);
        m[s]=1;
    }
    for(int i=0;i<v.size();i++)
    {
        string s1=v[i];
        for(int j=i+1;j<v.size();j++)
        {
            string s2=v[j];
            string s3="";
            for(int l=0;l<k;l++)
            {
                if(s2[l]==s1[l])
                {
                    s3=s3+s1[l];
                }
                else if(s1[l]!='S'&&s2[l]!='S')
                {
                    s3=s3+'S';
                }
                else if(s1[l]!='E'&&s2[l]!='E')
                {
                    s3=s3+'E';
                }
                else if(s1[l]!='T'&&s2[l]!='T')
                {
                    s3=s3+'T';
                }
            }
            if(m.count(s3)==1)
            {
                c+=1;
            }
        }
    }
    cout<<(c/3);
}
int main()
{
	fast
	int n=1;
	test(n)
	{
	    solve();
	}
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details