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>
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |