# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148496 | TLEWA맞 (#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 <bits/stdc++.h>
using namespace std;
int n,B[202020],T[202020],G[202020],check[103][103][103];
long long combi(int p)
{
return (long long)p*(p-1)/2;
}
long long CountSimilarPairs(int[] B, int[] T,int[] G)
{
long long ans=0;
for(int i=0;i<n;i++)
{
check[B[i]][T[i]][G[i]]++;
} for(int i=1;i<=100;i++)
{
for(int j=1;j<=100;j++)
{
for(int k=1;k<=100;k++)
{
ans-=combi(check[i][j][k]);
}
}
} int brr[202020],trr[202020],grr[202020];
for(int i=0;i<n;i++)
{
brr[B[i]]++; trr[T[i]]++; grr[G[i]]++;
} for(int i=1;i<=100;i++)
{
ans+=combi(brr[i])+combi(trr[i])+combi(grr[i]);
} return ans;
}