#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+=(g[i][j][k]-1)*g[i][j][k]/2;
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
8 ms |
512 KB |
Output is correct |
4 |
Correct |
9 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
2048 KB |
Output is correct |
6 |
Correct |
9 ms |
2816 KB |
Output is correct |
7 |
Correct |
9 ms |
3712 KB |
Output is correct |
8 |
Correct |
9 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
5888 KB |
Output is correct |
10 |
Correct |
10 ms |
5632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Correct |
8 ms |
512 KB |
Output is correct |
4 |
Correct |
9 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
2048 KB |
Output is correct |
6 |
Correct |
9 ms |
2816 KB |
Output is correct |
7 |
Correct |
9 ms |
3712 KB |
Output is correct |
8 |
Correct |
9 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
5888 KB |
Output is correct |
10 |
Correct |
10 ms |
5632 KB |
Output is correct |
11 |
Correct |
13 ms |
8064 KB |
Output is correct |
12 |
Correct |
18 ms |
1152 KB |
Output is correct |
13 |
Correct |
33 ms |
8564 KB |
Output is correct |
14 |
Correct |
45 ms |
10604 KB |
Output is correct |
15 |
Correct |
60 ms |
11500 KB |
Output is correct |
16 |
Correct |
74 ms |
5224 KB |
Output is correct |
17 |
Correct |
82 ms |
5396 KB |
Output is correct |
18 |
Correct |
83 ms |
7524 KB |
Output is correct |
19 |
Correct |
89 ms |
13420 KB |
Output is correct |
20 |
Correct |
96 ms |
13416 KB |
Output is correct |