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;
typedef long long ll;
#define endl '\n'
void solve(){
int n,k;
cin>>n>>k;
vector<string> v(n);
for(auto &i:v) cin>>i;
map<string,bool> exist;
for(auto i : v) exist[i] = 1;
ll ans = 0;
for(int i=0;i<n;i++){
exist[v[i]] = 0;
for(int j=i+1;j<n;j++){
exist[v[j]] = 0;
string tmp = "";
for(int f=0;f<k;f++){
if(v[i][f] == v[j][f]) tmp += v[i][f];
else tmp += 6-(v[i][f]-48+v[j][f]-48) + 48;
}
if(exist[tmp]) ans ++;
}
for(int j=i+1;j<n;j++) exist[v[j]] = 1;
}
cout<<ans<<endl;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
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... |