# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
219865 | 2020-04-06T15:14:13 Z | mhy908 | PIN (CEOI10_pin) | C++14 | 49 ms | 13944 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 36 ms | 13696 KB | Output is correct |
2 | Correct | 36 ms | 13568 KB | Output is correct |
3 | Correct | 35 ms | 13696 KB | Output is correct |
4 | Correct | 40 ms | 13696 KB | Output is correct |
5 | Correct | 40 ms | 13696 KB | Output is correct |
6 | Correct | 40 ms | 13696 KB | Output is correct |
7 | Correct | 40 ms | 13696 KB | Output is correct |
8 | Correct | 42 ms | 13696 KB | Output is correct |
9 | Correct | 46 ms | 13824 KB | Output is correct |
10 | Correct | 46 ms | 13824 KB | Output is correct |
11 | Correct | 41 ms | 13696 KB | Output is correct |
12 | Correct | 46 ms | 13824 KB | Output is correct |
13 | Correct | 42 ms | 13824 KB | Output is correct |
14 | Correct | 41 ms | 13824 KB | Output is correct |
15 | Correct | 45 ms | 13824 KB | Output is correct |
16 | Correct | 45 ms | 13824 KB | Output is correct |
17 | Correct | 47 ms | 13944 KB | Output is correct |
18 | Correct | 44 ms | 13824 KB | Output is correct |
19 | Correct | 45 ms | 13824 KB | Output is correct |
20 | Correct | 49 ms | 13824 KB | Output is correct |