Submission #97750

#TimeUsernameProblemLanguageResultExecution timeMemory
97750dalgerokParametriziran (COCI19_parametriziran)C++17
110 / 110
330 ms3240 KiB
#include<bits/stdc++.h> using namespace std; const int N = 5e4; bitset < N > q[6][26], a; int main(){ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); 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++){ q[j][k][i] = true; } } else{ q[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 > cur = a; for(int j = 0; j < m; j++){ if(s[i][j] == '?'){ continue; } cur &= q[j][s[i][j] - 'a']; } ans += cur.count(); } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...