#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
int n,check[103][103][103],brr[103],trr[103],grr[103];
int check1[103][103], check2[103][103], check3[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]]++;
check1[B[i]][T[i]]++;
check2[T[i]][G[i]]++;
check3[B[i]][G[i]]++;
} for(int i=1;i<=100;i++)
{
for(int j=1;j<=100;j++)
{
ans-=combi(check1[i][j])+combi(check2[i][j])+combi(check3[i][j]);
for(int k=1;k<=100;k++)
ans+=combi(check[i][j][k]);
}
} 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 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
384 KB |
Output is correct |
4 |
Correct |
8 ms |
640 KB |
Output is correct |
5 |
Correct |
8 ms |
1792 KB |
Output is correct |
6 |
Correct |
9 ms |
2304 KB |
Output is correct |
7 |
Correct |
10 ms |
3072 KB |
Output is correct |
8 |
Correct |
8 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
4096 KB |
Output is correct |
10 |
Correct |
11 ms |
4096 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
7 ms |
384 KB |
Output is correct |
4 |
Correct |
8 ms |
640 KB |
Output is correct |
5 |
Correct |
8 ms |
1792 KB |
Output is correct |
6 |
Correct |
9 ms |
2304 KB |
Output is correct |
7 |
Correct |
10 ms |
3072 KB |
Output is correct |
8 |
Correct |
8 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
4096 KB |
Output is correct |
10 |
Correct |
11 ms |
4096 KB |
Output is correct |
11 |
Correct |
11 ms |
4736 KB |
Output is correct |
12 |
Correct |
19 ms |
1024 KB |
Output is correct |
13 |
Correct |
33 ms |
5620 KB |
Output is correct |
14 |
Correct |
43 ms |
6768 KB |
Output is correct |
15 |
Correct |
60 ms |
7660 KB |
Output is correct |
16 |
Correct |
82 ms |
5228 KB |
Output is correct |
17 |
Correct |
81 ms |
5352 KB |
Output is correct |
18 |
Correct |
84 ms |
6508 KB |
Output is correct |
19 |
Correct |
88 ms |
9448 KB |
Output is correct |
20 |
Correct |
87 ms |
9444 KB |
Output is correct |