Submission #96579

#TimeUsernameProblemLanguageResultExecution timeMemory
96579MilkiParametriziran (COCI19_parametriziran)C++14
110 / 110
267 ms3036 KiB
#include<bits/stdc++.h> using namespace std; #define FOR(i, a, b) for(int i = a; i < b; ++i) #define REP(i, n) FOR(i, 0, n) #define _ << " " << #define sz(x) ((int) x.size()) #define pb(x) push_back(x) #define TRACE(x) cerr << #x << " = " << x << endl typedef long long ll; typedef pair<int, int> point; const int MAXN = 5e4 + 5; int n, m; string s[MAXN]; bitset<MAXN> bit[8][28]; bitset<MAXN> pun; void ukloni(int x){ pun.set(x, 0); REP(j, m){ if(s[x][j] == '?'){ REP(k, 26) bit[j][k].set(x, 0); } else bit[j][ s[x][j] - 'a' ].set(x, 0); } } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; REP(i, n) cin >> s[i]; REP(i, n) pun.set(i); REP(i, n) REP(j, m){ if(s[i][j] == '?'){ REP(k, 26) bit[j][k].set(i); } else bit[j][ s[i][j] - 'a' ].set(i); } ll sol = 0; REP(i, n){ bitset<MAXN> bits; bits.reset(); ukloni(i); if(s[i][0] == '?') bits |= pun; else bits = bit[0][ s[i][0] - 'a' ]; FOR(j, 1, m){ if(s[i][j] == '?') continue; bits &= bit[j][ s[i][j] - 'a' ]; } sol += bits.count(); } cout << sol; }
#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...