Submission #111925

#TimeUsernameProblemLanguageResultExecution timeMemory
111925fredbrParametriziran (COCI19_parametriziran)C++17
110 / 110
168 ms2972 KiB
#include <bits/stdc++.h> #pragma GCC target("popcnt") using namespace std; int const maxn = 50505; int const maxm = 7; bitset<maxn> cnt[maxm][30]; bitset<maxn> tmp, at; 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 i = 0; i < n; i++) at[i] = true; for (int j = 0; j < n; j++) { auto const& s = v[j]; at[j] = false; tmp = at; 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 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...