#include "museum.h"
using namespace std;
int Bs[111], Ts[111], Gs[111], BT[111][111], TG[111][111], BG[111][111], BTG[111][111][111];
long long sum;
long long CountSimilarPairs(int N, vector<int> B_, vector<int> T_, vector<int> G_) {
for(int i=0; i<N; i++){
int B=B_[i], T=T_[i], G=G_[i];
sum += Bs[B]+Ts[T]+Gs[G];
Bs[B]++, Ts[T]++, Gs[G]++;
sum -= BT[B][T]+TG[T][G]+BG[B][G];
BT[B][T]++, TG[T][G]++, BG[B][G]++;
sum += BTG[B][T][G];
BTG[B][T][G]++;
}
return sum;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
1792 KB |
Output is correct |
6 |
Correct |
4 ms |
2304 KB |
Output is correct |
7 |
Correct |
7 ms |
3072 KB |
Output is correct |
8 |
Correct |
2 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
4352 KB |
Output is correct |
10 |
Correct |
8 ms |
4196 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
640 KB |
Output is correct |
5 |
Correct |
4 ms |
1792 KB |
Output is correct |
6 |
Correct |
4 ms |
2304 KB |
Output is correct |
7 |
Correct |
7 ms |
3072 KB |
Output is correct |
8 |
Correct |
2 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
4352 KB |
Output is correct |
10 |
Correct |
8 ms |
4196 KB |
Output is correct |
11 |
Correct |
8 ms |
5120 KB |
Output is correct |
12 |
Correct |
13 ms |
1100 KB |
Output is correct |
13 |
Correct |
27 ms |
5836 KB |
Output is correct |
14 |
Correct |
34 ms |
7252 KB |
Output is correct |
15 |
Correct |
45 ms |
8176 KB |
Output is correct |
16 |
Correct |
56 ms |
5212 KB |
Output is correct |
17 |
Correct |
59 ms |
5400 KB |
Output is correct |
18 |
Correct |
62 ms |
6628 KB |
Output is correct |
19 |
Correct |
106 ms |
10036 KB |
Output is correct |
20 |
Correct |
86 ms |
10088 KB |
Output is correct |