Submission #238952

# Submission time Handle Problem Language Result Execution time Memory
238952 2020-06-13T18:27:12 Z dolphingarlic PIN (CEOI10_pin) C++14
0 / 100
55 ms 4316 KB
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

unordered_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 += (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 Incorrect 6 ms 640 KB Output isn't correct
2 Incorrect 6 ms 640 KB Output isn't correct
3 Incorrect 6 ms 640 KB Output isn't correct
4 Incorrect 19 ms 1152 KB Output isn't correct
5 Incorrect 23 ms 1408 KB Output isn't correct
6 Incorrect 23 ms 1408 KB Output isn't correct
7 Incorrect 20 ms 1152 KB Output isn't correct
8 Incorrect 25 ms 1408 KB Output isn't correct
9 Incorrect 35 ms 1408 KB Output isn't correct
10 Incorrect 38 ms 1408 KB Output isn't correct
11 Incorrect 23 ms 1408 KB Output isn't correct
12 Incorrect 36 ms 1408 KB Output isn't correct
13 Incorrect 26 ms 1408 KB Output isn't correct
14 Incorrect 24 ms 1408 KB Output isn't correct
15 Incorrect 37 ms 1408 KB Output isn't correct
16 Incorrect 38 ms 3504 KB Output isn't correct
17 Incorrect 55 ms 4316 KB Output isn't correct
18 Incorrect 43 ms 3752 KB Output isn't correct
19 Incorrect 49 ms 4184 KB Output isn't correct
20 Incorrect 55 ms 4312 KB Output isn't correct