#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N = 5e5 + 5;
const ll INF = 1e18 + 10;
int n, d, ans;
string a[N];
int f(string s1, string s2){
int ret = 0;
for (int i = 0; i < 4; i++){
ret += (s1[i] != s2[i]);
}
return ret;
}
int main (){
cin >> n >> d;
for (int i = 0; i < n; i++){
cin >> a[i];
for (int j = 0; j < i; j++){
ans += (f(a[i], a[j]) == d);
}
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
40 ms |
16132 KB |
Output is correct |
2 |
Correct |
40 ms |
15980 KB |
Output is correct |
3 |
Correct |
26 ms |
15980 KB |
Output is correct |
4 |
Execution timed out |
1079 ms |
16100 KB |
Time limit exceeded |
5 |
Execution timed out |
1087 ms |
16228 KB |
Time limit exceeded |
6 |
Execution timed out |
1079 ms |
16136 KB |
Time limit exceeded |
7 |
Execution timed out |
1090 ms |
16100 KB |
Time limit exceeded |
8 |
Execution timed out |
1095 ms |
16228 KB |
Time limit exceeded |
9 |
Execution timed out |
1092 ms |
16200 KB |
Time limit exceeded |
10 |
Execution timed out |
1092 ms |
16228 KB |
Time limit exceeded |
11 |
Execution timed out |
1051 ms |
16136 KB |
Time limit exceeded |
12 |
Execution timed out |
1037 ms |
16228 KB |
Time limit exceeded |
13 |
Execution timed out |
1092 ms |
16136 KB |
Time limit exceeded |
14 |
Execution timed out |
1050 ms |
16132 KB |
Time limit exceeded |
15 |
Execution timed out |
1089 ms |
16228 KB |
Time limit exceeded |
16 |
Execution timed out |
1098 ms |
16228 KB |
Time limit exceeded |
17 |
Execution timed out |
1094 ms |
16228 KB |
Time limit exceeded |
18 |
Execution timed out |
1098 ms |
16100 KB |
Time limit exceeded |
19 |
Execution timed out |
1092 ms |
16228 KB |
Time limit exceeded |
20 |
Execution timed out |
1096 ms |
16228 KB |
Time limit exceeded |