Submission #743519

#TimeUsernameProblemLanguageResultExecution timeMemory
743519sword060Set (COCI21_set)C++17
40 / 110
1044 ms44412 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...