#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
int n,check[103][103][103];
long long combi(int p)
{
return (long long)p*(p-1)/2;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G)
{
n=B.size();
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-=2*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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Incorrect |
8 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Incorrect |
8 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |