Submission #96754

# Submission time Handle Problem Language Result Execution time Memory
96754 2019-02-11T17:31:37 Z tpoppo Parametriziran (COCI19_parametriziran) C++14
110 / 110
272 ms 2968 KB
#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 time Memory Grader output
1 Correct 176 ms 2124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 135 ms 2288 KB Output is correct
2 Correct 109 ms 2288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 144 ms 2296 KB Output is correct
2 Correct 189 ms 2296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 132 ms 2460 KB Output is correct
2 Correct 130 ms 2424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 193 ms 2464 KB Output is correct
2 Correct 92 ms 2620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 2628 KB Output is correct
2 Correct 152 ms 2620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 173 ms 2792 KB Output is correct
2 Correct 112 ms 2792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 2784 KB Output is correct
2 Correct 194 ms 2808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 189 ms 2908 KB Output is correct
2 Correct 120 ms 2956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 272 ms 2968 KB Output is correct
2 Correct 221 ms 2960 KB Output is correct