#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> BXX, XTX, XXG, BTX, BXG, XTG, BTG;
long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
int N = B.size();
long long ans = 0;
for (int i = 0; i < N; i++) {
int b = B[i], t = T[i], g = G[i];
ans += BXX[b]++;
ans += XTX[t]++;
ans += XXG[g]++;
ans -= BTX[b * 1000 + t]++;
ans -= BXG[b * 1000 + g]++;
ans -= XTG[t * 1000 + g]++;
ans += BTG[b * 1000000 + t * 1000 + g]++;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
508 KB |
Output is correct |
7 |
Correct |
3 ms |
504 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
760 KB |
Output is correct |
10 |
Correct |
5 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
508 KB |
Output is correct |
7 |
Correct |
3 ms |
504 KB |
Output is correct |
8 |
Correct |
3 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
760 KB |
Output is correct |
10 |
Correct |
5 ms |
760 KB |
Output is correct |
11 |
Correct |
9 ms |
1272 KB |
Output is correct |
12 |
Correct |
17 ms |
1272 KB |
Output is correct |
13 |
Correct |
68 ms |
6092 KB |
Output is correct |
14 |
Correct |
98 ms |
7532 KB |
Output is correct |
15 |
Correct |
174 ms |
11432 KB |
Output is correct |
16 |
Correct |
97 ms |
6368 KB |
Output is correct |
17 |
Correct |
114 ms |
6380 KB |
Output is correct |
18 |
Correct |
162 ms |
10960 KB |
Output is correct |
19 |
Correct |
252 ms |
15464 KB |
Output is correct |
20 |
Correct |
247 ms |
15488 KB |
Output is correct |