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 <unordered_map>
#include "museum.h"
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
const int N = B.size();
std::unordered_map<int, int> a, b, c;
for (int i = 0; i < N; ++i) {
++a[B[i]];
++a[T[i] + 201];
++a[G[i] + 401];
++b[B[i] * 100 + T[i]];
++b[T[i] * 100 + G[i] + 20001];
++b[G[i] * 100 + B[i] + 40001];
++c[B[i] * 10000 + T[i] * 100 + G[i]];
}
long long ans = 0;
for (const auto& it : a) {
ans += it.second * (long long)(it.second - 1) / 2;
}
for (const auto& it : b) {
ans -= it.second * (long long)(it.second - 1) / 2;
}
for (const auto& it : c) {
ans += it.second * (long long)(it.second - 1) / 2;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |