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<iostream>
#include<vector>
#include<string>
#include<set>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,k;
cin>>n>>k;
vector<string> vec(n);
for(int i=0;i<n;i++) cin>>vec[i];
set<string> s;
for(int i=0;i<n;i++) s.insert(vec[i]);
int cnt=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
//s.erase(vec[i]);
//s.erase(vec[j]);
string tmp=vec[i];
for(int l=0;l<k;l++){
if(vec[i][l]==vec[j][l]){
tmp[l]=vec[i][l];
}
else {
tmp[l]=6-(vec[i][l]-'0')-(vec[j][l]-'0')+'0';
}
}
if(s.count(tmp)) cnt++;
//s.insert(vec[i]);
//s.insert(vec[j]);
}
}
cout<<cnt/3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |