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;
int n,k,a,b;
set<string> v;
vector<string> vec;
string s;
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k;
for (int i = 0;i<n;i++) {
cin >> s;
v.insert(s);
vec.push_back(s);
}
int ans = 0;
for (int i = 0;i<n;i++){
for (int j = i+1;j<n;j++){
string sr;
for (int c = 0;c<k;c++){
if (vec[i][c] == vec[j][c]) sr += vec[i][c];
else {
char t = 6-vec[i][c]-vec[j][c]+'0'*3;
sr += t;
}
}
ans += v.count(sr);
}
}
cout << ans/3;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |