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"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
map<int,int> sb[8];
vector<int> S[3]={B,T,G};
for(int i=0;i<N;++i)
{
for(int j=1;j<8;++j)
{
int w=0;
for(int k=0;k<3;++k)
if(j&(1<<k))
w=w*233+S[k][i];
++sb[j][w];
}
}
long long a=0;
for(int j=1;j<8;++j)
{
int k=-1;
if(__builtin_popcount(j)&1) k=1;
for(auto t:sb[j])
a+=t.second*(ll)(t.second-1)/2*k;
}
return a;
}
#ifdef LOCAL
#include "grader.cpp"
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |