#include <bits/stdc++.h>
#pragma GCC target("popcnt")
using namespace std;
int const maxn = 50000;
int const maxm = 7;
bitset<maxn> cnt[6][26];
bitset<maxn> tmp;
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<string> v(n);
for (int i = 0; i < n; i++) {
auto& s = v[i];
cin >> s;
for (int j = 0; j < m; j++) {
if (s[j] == '?')
for (int k = 0; k < 26; k++)
cnt[j][k][i] = true;
else
cnt[j][s[j] - 'a'][i] = true;
}
}
int64_t ans = 0;
for (int j = 0; j < n; j++) {
auto const& s = v[j];
tmp.reset();
tmp.flip();
tmp >>= j+1;
for (int i = 0; i < m; i++) {
char c = s[i];
if (c == '?') continue;
tmp &= cnt[i][c-'a'];
}
ans += tmp.count();
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
117 ms |
2048 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
91 ms |
1664 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
113 ms |
1920 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
129 ms |
1792 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
160 ms |
2352 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
183 ms |
2560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
149 ms |
2176 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
182 ms |
2560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
174 ms |
2304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
236 ms |
2816 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |