#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 50000;
const int MAX_M = 6;
int N, M;
int main() {
cin >> N >> M;
int c = 0;
char words[MAX_N][MAX_M];
for (int i = 0; i < N; ++i) { // Read input O(NM)
for (int j = 0; j < M; ++j) {
cin >> words[i][j];
}
}
// For every pair (a, b) - O(N^2 * M)
for (int i = 0; i < N; ++i) {
for (int j = i + 1; j < N; ++j) {
int valid = 1;
for (int k = 0; k < M; ++k) {
if (words[i][k] == '?' || words[j][k] == '?')
continue;
if (words[i][k] != words[j][k])
{
valid = 0;
break;
}
}
c += valid;
}
}
cout << c;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2505 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2090 ms |
628 KB |
Output is correct |
2 |
Execution timed out |
3038 ms |
768 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3053 ms |
632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2132 ms |
648 KB |
Output is correct |
2 |
Execution timed out |
3049 ms |
632 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3011 ms |
760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3019 ms |
760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3036 ms |
760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3019 ms |
760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2425 ms |
784 KB |
Output is correct |
2 |
Execution timed out |
3042 ms |
760 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3088 ms |
888 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |