# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
219863 | mhy908 | PIN (CEOI10_pin) | C++14 | 50 ms | 14200 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;
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);
d=4-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[1]+ans[2]+ans[3];
printf("%d", ans[d]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |