제출 #1339464

#제출 시각아이디문제언어결과실행 시간메모리
1339464po_rag526Parametriziran (COCI19_parametriziran)C++17
110 / 110
139 ms1436 KiB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
#define int ll

const int MAXN = 5e4 + 5;

int n, m;
bitset<50000> wh[6][27];
bitset<50000> alls;
bitset<50000> b;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m;
    for(int i = 0; i < n; i++)
        alls[i] = 1;
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        b = alls;
        for(int j = 0; j < m; j++)
        {
            if(s[j] == '?')
            {
                b &= wh[j][0]; // asta e literally tot dar e ok
                for(int k = 0; k < 27; k++)
                {
                    wh[j][k][i] = 1;
                }
            }
            else
            {
                b &= wh[j][s[j] - 'a' + 1];
                wh[j][0][i] = 1;
                wh[j][s[j] - 'a' + 1][i] = 1;
            }
        }
//        for(int j = 0; j <= n; j++)
//            cout << b[j] << ' ';
//        cout << '\n';
        ans += b.count();
    }
    cout << ans;

    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...