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 N=6e5,M=5000;
long long x,k,a[N],ans=0;
map<long long,int>cnt;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>x>>k;
for(int i=1;i<=x;i++)
cin>>a[i],cnt[a[i]]=1;
for(int i=1;i<=x;i++){
cnt[a[i]]=0;
for(int j=1;j<i;j++){
long long c=a[j],c2=a[i],c3=0;
string p="";
for(int z=0;z<k;z++){
char n;
if(c%10==c2%10)n=(c%10)+'0';
else n=((c%10)^(c2%10))+'0';
c/=10;c2/=10;
p=n+p;
}
for(int z=0;z<k;z++)
c3=c3*10+(p[z]-'0');
ans+=cnt[c3];
}
}
cout<<ans;
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... |