# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149976 | test team (#200) | 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.
#include "museum.h"
long long a[101],b[101],c[101],d[101][101],e[101][101],f[101][101],g[101][101][101];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int n = B.size();
long long ret=0;
for(int i=0;i<n;i++)
{
a[B[i]]++;
b[T[i]]++;
c[G[i]]++;
d[B[i]][T[i]]++;
e[B[i]][G[i]]++;
f[T[i]][G[i]]++;
g[B[i]][T[i]][G[i]]++;
}
for(int i=1;i<=100;i++)
ret+=((a[i]-1)*a[i]+(b[i]-1])*b[i]+(c[i]-1)*c[i])/2;
for(int i=1;i<=100;i++)
for(int j=1;j<=100;j++)
ret-=((d[i][j]-1)*d[i][j]+(e[i][j]-1])*e[i][j]+(f[i][j]-1)*f[i][j])/2;
for(int i=1;i<=100;i++)
for(int j=1;j<=100;j++)
for(int k=1;k<=100;k++)
ret+=(f[i][j][k]-1])*f[i][j][k]/2;
return ret;
}