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;
using ll = long long;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(0);
int n,k;
cin >> n >> k;
set <string> mlt;
for(int i = 0;i < n;i++){
string s;
cin >> s;
mlt.insert(s);
}
ll res = 0;
for(string s1 : mlt){
for(string s2 : mlt){
if(s1 == s2)continue;
string target = "";
for(int i = 0;i < k;i++){
if(s1[i] == s2[i]){
target += s1[i];
}else{
if(s1[i] != '1' && s2[i] != '1'){
target += '1';
}else if(s1[i] != '2' && s2[i] != '2'){
target += '2';
}else{
target += '3';
}
}
}
res += mlt.count(target);
}
res /= 2;
}
cout << res;
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... |