Submission #951853

#TimeUsernameProblemLanguageResultExecution timeMemory
951853Saul0906PIN (CEOI10_pin)C++14
15 / 100
1104 ms89680 KiB
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a:b)
#define fi first
#define se second
#define pii pair<int, int>
#define ll long long
#define endl "\n"

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, d, ans=0;
	cin>>n>>d;
	string s[n], t;
	map<string,int> ss;
	rep(i,0,n){
		cin>>s[i];
		t=s[i];
		rep(k,0,4){
			rep(j,0,10) if(j+'0'!=s[i][k]) t[k]=j+'0', ans+=ss[t];
			rep(j,0,26) if(j+'a'!=s[i][k]) t[k]=j+'a', ans+=ss[t];
			t[k]=s[i][k];
		}
		ss[s[i]]++;
	}
	cout<<ans<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...