#include <bits/stdc++.h>
#include "museum.h"
using namespace std;
int O[3][111];
int W[3][111][111];
int C[111][111][111];
long long f(int x) {
return 1LL * x * (x-1) / 2;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
for(int i=0; i<N; i++) {
++O[0][B[i]];
++O[1][T[i]];
++O[2][G[i]];
++W[0][T[i]][G[i]];
++W[1][B[i]][G[i]];
++W[2][B[i]][T[i]];
++C[B[i]][T[i]][G[i]];
}
long long ans = 0;
for(int i=1; i<=100; i++) {
ans += f(O[0][i]);
ans += f(O[1][i]);
ans += f(O[2][i]);
}
for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) {
ans -= f(W[0][i][j]);
ans -= f(W[1][i][j]);
ans -= f(W[2][i][j]);
}
for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) for(int k=1; k<=100; k++) {
ans += f(C[i][j][k]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
256 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
9 ms |
512 KB |
Output is correct |
4 |
Correct |
8 ms |
688 KB |
Output is correct |
5 |
Correct |
9 ms |
1792 KB |
Output is correct |
6 |
Correct |
9 ms |
2304 KB |
Output is correct |
7 |
Correct |
10 ms |
3200 KB |
Output is correct |
8 |
Correct |
9 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
4224 KB |
Output is correct |
10 |
Correct |
10 ms |
4224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
256 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
9 ms |
512 KB |
Output is correct |
4 |
Correct |
8 ms |
688 KB |
Output is correct |
5 |
Correct |
9 ms |
1792 KB |
Output is correct |
6 |
Correct |
9 ms |
2304 KB |
Output is correct |
7 |
Correct |
10 ms |
3200 KB |
Output is correct |
8 |
Correct |
9 ms |
512 KB |
Output is correct |
9 |
Correct |
10 ms |
4224 KB |
Output is correct |
10 |
Correct |
10 ms |
4224 KB |
Output is correct |
11 |
Correct |
12 ms |
5248 KB |
Output is correct |
12 |
Correct |
20 ms |
1152 KB |
Output is correct |
13 |
Correct |
34 ms |
5748 KB |
Output is correct |
14 |
Correct |
43 ms |
7268 KB |
Output is correct |
15 |
Correct |
62 ms |
8304 KB |
Output is correct |
16 |
Correct |
82 ms |
5100 KB |
Output is correct |
17 |
Correct |
83 ms |
5356 KB |
Output is correct |
18 |
Correct |
88 ms |
6508 KB |
Output is correct |
19 |
Correct |
98 ms |
10092 KB |
Output is correct |
20 |
Correct |
95 ms |
10092 KB |
Output is correct |