Submission #96754

#TimeUsernameProblemLanguageResultExecution timeMemory
96754tpoppoParametriziran (COCI19_parametriziran)C++14
110 / 110
272 ms2968 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e4 + 100; const int MAXM = 7; bitset<MAXN> v[MAXM][27]; string s[MAXN]; int n,m; int rs; bitset<MAXN> ones; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin>>n>>m; for(int t=0;t<n;t++){ cin>>s[t]; for(int j = 0;j<m;j++){ if(s[t][j] == '?'){ for(int i=0;i<27;i++){ v[j][i][t] = 1; } }else{ v[j][s[t][j] - 'a'][t] = 1; } } } for(int i=0;i<n;i++) ones[i] = 1; for(int i=0;i<n;i++){ ones[i] = 0; bitset<MAXN> good = ones; for(int j=0;j<m;j++){ if(s[i][j] == '?') continue; good &= v[j][s[i][j] - 'a']; //cout<<s[i]<<": "<<good<<" - "<<v[j][s[i][j] - 'a']<<endl; } rs += good.count(); } cout<<rs; return 0; }
#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...