Submission #310460

#TimeUsernameProblemLanguageResultExecution timeMemory
310460phathnvParametriziran (COCI19_parametriziran)C++11
110 / 110
279 ms1784 KiB
#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(){ //freopen(taskname".inp", "r", stdin); //freopen(taskname".out", "w", stdout); readInput(); solve(); 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...