Submission #148523

#TimeUsernameProblemLanguageResultExecution timeMemory
1485231 WA = 5 Push Up (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
223 ms13856 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...