이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |