# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152312 | cheetose | FunctionCup Museum (FXCUP4_museum) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
int c[100][100][100];
inline ll r(int x){return 1LL*x*(x-1)/2;}
ll CountSimilarPairs(Vi B, Vi T, Vi G)
{
int N=B.size();
fup(i,0,N-1,1)c[B[i]-1][T[i]-1][G[i]-1]++;
ll ans=0;
fup(i,0,99,1)
{
int t=0;
fup(j,0,99,1)fup(k,0,99,1)t+=c[i][j][k];
ans+=r(t);
t=0;
fup(j,0,99,1)fup(k,0,99,1)t+=c[j][i][k];
ans+=r(t);
t=0;
fup(j,0,99,1)fup(k,0,99,1)t+=c[k][j][i];
ans+=r(t);
}
fup(i,0,99,1)
fup(j,0,99,1)
{
int t=0;
fup(k,0,99,1)t+=c[i][j][k];
ans-=r(t);
t=0;
fup(k,0,99,1)t+=c[j][k][i];
ans-=r(t);
t=0;
fup(k,0,99,1)t+=c[k][j][i];
ans-=r(t);
}
fup(i,0,99,1)fup(j,0,99,1)fup(k,0,99,1)ans+=r(c[i][j][k]);
return ans;
}