Submission #96604

# Submission time Handle Problem Language Result Execution time Memory
96604 2019-02-10T11:50:14 Z tpoppo Parametriziran (COCI19_parametriziran) C++14
0 / 110
3000 ms 1528 KB
#include <bits/stdc++.h>

using namespace std;
const int MAXN = 5e4 + 100;
const int MAXM = 6;

bitset<27*MAXM> v[MAXN];
int n,m;
int rs;
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n>>m;
    for(int t=0;t<n;t++){
        string s;
        cin>>s;
        for(int i=0;i<m;i++){
            if(s[i] == '?'){
                for(int j=0;j<27;j++){
                    v[t][27*i + j] = 1;
                }
            }else{
                v[t][27*i + s[i] - 'a'] = 1;
            }
        }
    }


    for(int i=0;i<n;i++){
        //cout<<i<<": "<<v[i]<<endl;
        for(int j=i+1;j<n;j++){
            bool f = true;
            bitset<27*MAXM> bt = (v[i]&v[j]);
            int cnt = bt.count();
            for(int i=0;i<m;i++){
                bt>>=27;
                int tmp = bt.count();
                if(tmp == cnt ){
                    f = false;
                    break;
                }
                cnt = tmp;
            }

            rs += f;
        }
    }

    cout<<rs;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 3040 ms 1528 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 3054 ms 1016 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3036 ms 1276 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3077 ms 1016 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3022 ms 1528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3043 ms 1404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3050 ms 1144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3065 ms 1328 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3057 ms 1144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3052 ms 1528 KB Time limit exceeded
2 Halted 0 ms 0 KB -