#include "museum.h"
long long a[101], b[101], c[101];
long long d[101][101], e[101][101], f[101][101];
long long g[101][101][101];
inline long long F(long long x) {
return x * (x - 1) >> 1;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int i, j, k, N = B.size();
for (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]]++;
}
long long r = 0;
for (i = 1; i <= 100; i++) {
r += F(a[i]) + F(b[i]) + F(c[i]);
for (j = 1; j <= 100; j++) {
r -= F(d[i][j]) + F(e[i][j]) + F(f[i][j]);
for (k = 1; k <= 100; k++) r += F(g[i][j][k]);
}
}
return r;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 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 |
8 ms |
1920 KB |
Output is correct |
6 |
Correct |
9 ms |
2944 KB |
Output is correct |
7 |
Correct |
10 ms |
3712 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
10 ms |
5760 KB |
Output is correct |
10 |
Correct |
11 ms |
5760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 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 |
8 ms |
1920 KB |
Output is correct |
6 |
Correct |
9 ms |
2944 KB |
Output is correct |
7 |
Correct |
10 ms |
3712 KB |
Output is correct |
8 |
Correct |
9 ms |
640 KB |
Output is correct |
9 |
Correct |
10 ms |
5760 KB |
Output is correct |
10 |
Correct |
11 ms |
5760 KB |
Output is correct |
11 |
Correct |
13 ms |
8192 KB |
Output is correct |
12 |
Correct |
19 ms |
1152 KB |
Output is correct |
13 |
Correct |
35 ms |
8820 KB |
Output is correct |
14 |
Correct |
45 ms |
10608 KB |
Output is correct |
15 |
Correct |
61 ms |
11628 KB |
Output is correct |
16 |
Correct |
75 ms |
5220 KB |
Output is correct |
17 |
Correct |
79 ms |
5352 KB |
Output is correct |
18 |
Correct |
88 ms |
7528 KB |
Output is correct |
19 |
Correct |
97 ms |
13420 KB |
Output is correct |
20 |
Correct |
95 ms |
13292 KB |
Output is correct |