#include "museum.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
int b[101]={}, t[101]={}, g[101]={}, bt[101][101]={}, bg[101][101]={}, tg[101][101]={}, btg[101][101][101]={};
long long result=0;
for(int i=0; i<N; i++)
{
b[B[i]]++;
t[T[i]]++;
g[G[i]]++;
bg[B[i]][G[i]]++;
bt[B[i]][T[i]]++;
tg[T[i]][G[i]]++;
btg[B[i]][T[i]][G[i]]++;
}
for(int i=1; i<=100; i++)
{
result+=((b[i])*(b[i]-1ll))/2ll;
result+=((t[i])*(t[i]-1ll))/2ll;
result+=((g[i])*(g[i]-1ll))/2ll;
}
for(int i=1; i<=100; i++)
{
for(int j=1; j<=100; j++)
{
result-=((bt[i][j])*(bt[i][j]-1ll))/2ll;
result-=((tg[i][j])*(tg[i][j]-1ll))/2ll;
result-=((bg[i][j])*(bg[i][j]-1ll))/2ll;
}
}
for(int i=1; i<=100; i++)
{
for(int j=1; j<=100; j++)
{
for(int k=1; k<=100; k++)
result+=((btg[i][j][k])*(btg[i][j][k]-1ll))/2ll;
}
}
return result;
}
//int main(){}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4440 KB |
Output is correct |
2 |
Correct |
4 ms |
4440 KB |
Output is correct |
3 |
Correct |
4 ms |
4440 KB |
Output is correct |
4 |
Correct |
3 ms |
4444 KB |
Output is correct |
5 |
Correct |
3 ms |
4440 KB |
Output is correct |
6 |
Correct |
4 ms |
4440 KB |
Output is correct |
7 |
Correct |
4 ms |
4440 KB |
Output is correct |
8 |
Correct |
4 ms |
4440 KB |
Output is correct |
9 |
Correct |
4 ms |
4440 KB |
Output is correct |
10 |
Correct |
5 ms |
4700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4440 KB |
Output is correct |
2 |
Correct |
4 ms |
4440 KB |
Output is correct |
3 |
Correct |
4 ms |
4440 KB |
Output is correct |
4 |
Correct |
3 ms |
4444 KB |
Output is correct |
5 |
Correct |
3 ms |
4440 KB |
Output is correct |
6 |
Correct |
4 ms |
4440 KB |
Output is correct |
7 |
Correct |
4 ms |
4440 KB |
Output is correct |
8 |
Correct |
4 ms |
4440 KB |
Output is correct |
9 |
Correct |
4 ms |
4440 KB |
Output is correct |
10 |
Correct |
5 ms |
4700 KB |
Output is correct |
11 |
Correct |
5 ms |
4696 KB |
Output is correct |
12 |
Correct |
9 ms |
5208 KB |
Output is correct |
13 |
Correct |
13 ms |
5848 KB |
Output is correct |
14 |
Correct |
23 ms |
6620 KB |
Output is correct |
15 |
Correct |
26 ms |
7376 KB |
Output is correct |
16 |
Correct |
38 ms |
9196 KB |
Output is correct |
17 |
Correct |
40 ms |
10436 KB |
Output is correct |
18 |
Correct |
48 ms |
11140 KB |
Output is correct |
19 |
Correct |
42 ms |
10876 KB |
Output is correct |
20 |
Correct |
41 ms |
11300 KB |
Output is correct |