Submission #1033501

#TimeUsernameProblemLanguageResultExecution timeMemory
1033501ten_xdSet (COCI21_set)C++17
10 / 110
1096 ms16120 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define rep(a,b) for(int a = 0; a < (b); ++a)
#define all(t) t.begin(), t.end()
#define pb push_back

const int N = 5e5+5, INF = 2e9+54321;
const ll INF_L = (ll)2e18+54321;

int n,k,wyn;
string A[N];

void solve()
{
	cin >> n >> k;
	rep(i,n) cin >> A[i];

	rep(i,n)
	{
		for(int j = i+1; j < n; ++j)
		{
			for(int l = j+1; l < n; ++l)
			{
				bool ok = 1;
				rep(f,k)
				{
					bool o = 0;
					if(A[i][f] == A[j][f] and A[j][f] == A[l][f]) o = 1;
					if(A[i][f] != A[j][f] and A[j][f] != A[l][f] and A[i][f] != A[l][f]) o = 1;
					if(!o) ok = 0;
				}
				if(ok) ++wyn;
			}
		}
	}

	cout << wyn << '\n';
}

int main()
{	
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int T = 1;
	//cin >> T;
	while(T--) solve();

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...