This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |