This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define N 50000
bitset<N> vis[6][26], a;
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, m; cin >> n >> m;
string s[n];
for(int i = 0; i < n; i++){
cin >> s[i];
for(int j = 0; j < m; j++) {
if(s[i][j] == '?') for(int k = 0; k < 26; k++) vis[j][k][i] = true;
else vis[j][s[i][j] - 'a'][i] = true;
}
}
for(int i = 0; i < n; i++) a[i] = true;
long long ans = 0;
for(int i = 0; i < n; i++){
a[i] = false;
bitset<N> curr = a;
for(int j = 0; j < m; j++) if(s[i][j] != '?') curr &= vis[j][s[i][j] - 'a'];
ans += curr.count();
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |