# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
238954 |
2020-06-13T18:29:22 Z |
dolphingarlic |
PIN (CEOI10_pin) |
C++14 |
|
235 ms |
11768 KB |
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;
map<ll, ll> cnt[16];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n, d;
cin >> n >> d;
FOR(i, 0, n) {
string s;
cin >> s;
FOR(j, 0, 16) {
ll hsh = 0;
FOR(k, 0, 4) if (j & (1 << k))
hsh += ll(s[k] - '0' + 1) << (k * 10);
cnt[j][hsh]++;
}
}
ll ans = 0;
FOR(i, 0, 16) {
if (4 - __builtin_popcount(i) > d) continue;
ll contrib = 0;
for (pair<ll, ll> j : cnt[i])
contrib += j.second * (j.second - 1) / 2;
if ((d - 4 + __builtin_popcount(i)) & 1) ans -= contrib;
else ans += contrib;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
896 KB |
Output is correct |
2 |
Incorrect |
8 ms |
896 KB |
Output isn't correct |
3 |
Correct |
7 ms |
768 KB |
Output is correct |
4 |
Correct |
45 ms |
2680 KB |
Output is correct |
5 |
Correct |
66 ms |
3064 KB |
Output is correct |
6 |
Incorrect |
59 ms |
2936 KB |
Output isn't correct |
7 |
Incorrect |
48 ms |
2680 KB |
Output isn't correct |
8 |
Correct |
81 ms |
3136 KB |
Output is correct |
9 |
Correct |
94 ms |
4216 KB |
Output is correct |
10 |
Incorrect |
110 ms |
4600 KB |
Output isn't correct |
11 |
Incorrect |
58 ms |
3192 KB |
Output isn't correct |
12 |
Incorrect |
124 ms |
4600 KB |
Output isn't correct |
13 |
Incorrect |
81 ms |
3296 KB |
Output isn't correct |
14 |
Correct |
79 ms |
3196 KB |
Output is correct |
15 |
Correct |
100 ms |
4472 KB |
Output is correct |
16 |
Correct |
224 ms |
9084 KB |
Output is correct |
17 |
Incorrect |
235 ms |
11768 KB |
Output isn't correct |
18 |
Correct |
227 ms |
9720 KB |
Output is correct |
19 |
Correct |
191 ms |
10872 KB |
Output is correct |
20 |
Correct |
207 ms |
11640 KB |
Output is correct |