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>
#define mp make_pair
#define X first
#define Y second
#define taskname "Parametriziran"
using namespace std;
typedef long long ll;
typedef pair <int, int> ii;
const int N = 50000;
const int M = 6;
int n, m;
bitset <N> bs[M][26], cur;
void readInput(){
cin >> n >> m;
}
void solve(){
ll res = 0;
for(int i = 0; i < n; i++){
string s;
cin >> s;
bitset <N> tmp = cur;
for(int j = 0; j < m; j++){
if (s[j] == '?')
continue;
tmp &= bs[j][s[j] - 'a'];
}
res += tmp.count();
for(int j = 0; j < m; j++)
if (s[j] == '?')
for(int c = 0; c < 26; c++)
bs[j][c][i] = 1;
else
bs[j][s[j] - 'a'][i] = 1;
cur[i] = 1;
}
cout << res;
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//freopen(taskname".inp", "r", stdin);
//freopen(taskname".out", "w", stdout);
readInput();
solve();
return 0;
}
# | 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... |