/*
too fool to solve this problem
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define ll long long
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T> using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll INF = LLONG_MAX;
const ll N = 2 * 100000 + 5;
const ll MOD = 1e9 + 7;
ll binpow(ll a,ll b){
ll res = 1;
while(b){
if(b & 1){
res *= a;
}
a *= a;
b/=2;
}
return res;
}
void dumb_ass() {
ll n,d;
cin >> n >> d;
vector<string> a(n);
for(ll i = 0;i < n;i++){
cin >> a[i];
}
ll ans = 0;
for(ll i = 0;i < n;i++){
for(ll j = i + 1;j < n;j++){
ll cnt = 0;
for(ll k = 0;k < 4;k++){
if(a[i][k] != a[j][k]){
cnt++;
}
}
if(cnt == d){
ans++;
}
}
}
cout << ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
//freopen("A.in","r",stdin);
//freopen("A.out","w",stdout);
dumb_ass();
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |