This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const long long N = 5e2 + 5, inf = 1e17 + 5, mod = 998244353;
int main()
{
int n, kk;
cin >> n >> kk;
vector<string> arr(n);
for (int i = 0; i < n; i++)
cin >> arr[i];
int cnt = 0;
for (int i = 0; i < n - 2; i++)
{
for (int j = i + 1; j < n - 1; j++)
{
for (int k = j + 1; k < n; k++)
{
int flag = 0;
for (int s = 0; s < kk; s++)
if ((arr[i][s] == arr[j][s] && arr[j][s] == arr[k][s]) || (arr[i][s] != arr[j][s] && arr[i][s] != arr[k][s] && arr[j][s] != arr[k][s]))
flag++;
cnt += (flag == kk);
}
}
}
cout << cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |