Submission #759912

#TimeUsernameProblemLanguageResultExecution timeMemory
759912jk410FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
227 ms19980 KiB
#include <bits/stdc++.h> #include "museum.h" using namespace std; typedef long long ll; ll CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int n = (int)B.size(); map<int, int> b, t, g; map<pair<int, int>, int> bt, tg, gb; map<pair<pair<int, int>, int>, int> btg; ll ret = 0; for (int i = 0; i < n; i++) ret += b[B[i]]++; for (int i = 0; i < n; i++) ret += t[T[i]]++; for (int i = 0; i < n; i++) ret += g[G[i]]++; for (int i = 0; i < n; i++) ret -= bt[{B[i], T[i]}]++; for (int i = 0; i < n; i++) ret -= tg[{T[i], G[i]}]++; for (int i = 0; i < n; i++) ret -= gb[{G[i], B[i]}]++; for (int i = 0; i < n; i++) ret += btg[{ {B[i], T[i]}, G[i]}]++; return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...