# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
219865 | mhy908 | PIN (CEOI10_pin) | C++14 | 49 ms | 13944 KiB |
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;
typedef long long LL;
const int MAXX=1700000;
inline int ctoi(char c){
if('0'<=c&&c<='9')return c-'0';
return c-'a'+10;
}
int n, d;
LL arr[MAXX], ans[10];
char str[50010][5];
int main(){
scanf("%d %d", &n, &d);
for(int i=1; i<=n; i++)scanf("%s", str[i]+1);
for(int mask=0; mask<15; mask++){
memset(arr, 0, sizeof arr);
for(int i=1; i<=n; i++){
int tmp=0;
for(int j=1; j<=4; j++){
tmp*=36;
if(mask&(1<<(j-1)))tmp+=ctoi(str[i][j]);
}
ans[__builtin_popcount(mask)]+=arr[tmp]++;
}
}
ans[2]-=ans[3]*3;
ans[1]-=ans[3]*3+ans[2]*2;
ans[0]-=ans[3]+ans[2]+ans[1];
printf("%d", ans[4-d]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |