#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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
512 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
6 ms |
512 KB |
Output is correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
768 KB |
Output is correct |
10 |
Correct |
8 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
512 KB |
Output is correct |
3 |
Correct |
6 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
512 KB |
Output is correct |
6 |
Correct |
7 ms |
640 KB |
Output is correct |
7 |
Correct |
6 ms |
512 KB |
Output is correct |
8 |
Correct |
7 ms |
512 KB |
Output is correct |
9 |
Correct |
8 ms |
768 KB |
Output is correct |
10 |
Correct |
8 ms |
768 KB |
Output is correct |
11 |
Correct |
11 ms |
1280 KB |
Output is correct |
12 |
Correct |
20 ms |
1112 KB |
Output is correct |
13 |
Correct |
69 ms |
5668 KB |
Output is correct |
14 |
Correct |
119 ms |
6736 KB |
Output is correct |
15 |
Correct |
158 ms |
10472 KB |
Output is correct |
16 |
Correct |
93 ms |
5232 KB |
Output is correct |
17 |
Correct |
110 ms |
5224 KB |
Output is correct |
18 |
Correct |
155 ms |
9320 KB |
Output is correct |
19 |
Correct |
275 ms |
13716 KB |
Output is correct |
20 |
Correct |
260 ms |
13720 KB |
Output is correct |