# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
496476 | AkiYuu | PIN (CEOI10_pin) | C++17 | 170 ms | 5832 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>
#define ll long long
using namespace std;
string s[50001];
ll giong[5];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n,D;
cin >> n >> D;
for (int i = 1; i <= n; i++) cin >> s[i];
for (int mask = 0; mask < (1 << 4); mask++) {
map<string,int> mp;
mp.clear();
int cnt = __builtin_popcount(mask);
for (int i = 1; i <= n; i++) {
string tmp;
for (int j = 0; j < 4; j++)
if (mask & (1 << j)) tmp = tmp + s[i][j];
mp[tmp]++;
}
for (auto i: mp)
giong[cnt] += (i.second - 1)*(i.second)/2;
}
if (D == 1) cout << giong[3];
else if (D == 2) cout << giong[2] - 3*giong[3];
else if (D == 3) cout << giong[1] - 2*giong[2] + 3*giong[3];
else cout << giong[0] - giong[1] + giong[2] - 3*giong[3];
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |