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 "museum.h"
long long countB[211],countT[211],countG[211];
long long countBT[20501],countBG[20501],countTG[20501];
long long countBTG[2000101];
inline long long ct(long long x)
{
return x*(x-1)/2;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
long long ans = 0;
for (int i = 0; i<N; i++)
{
countB[B[i]]++;
countT[T[i]]++;
countG[G[i]]++;
countBT[B[i]*101+T[i]]++;
countBG[B[i]*101+G[i]]++;
countTG[T[i]*101+G[i]]++;
countBTG[B[i]*10201+T[i]*101+G[i]]++;
}
for (int i = 1; i<=210; i++)
{
ans += (ct(countB[i]));
ans += (ct(countG[i]));
ans += (ct(countT[i]));
}
for (int i = 1; i<=20500; i++)
{
ans -= ct(countBT[i]);
ans -= ct(countBG[i]);
ans -= ct(countTG[i]);
}
for (int i = 1; i<=2000000; i++)
ans += ct(countBTG[i]);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |