#include "museum.h"
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second
using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
i64 counts[105][105][105];
i64 bcounts[105];
i64 tcounts[105];
i64 gcounts[105];
i64 btcounts[105][105];
i64 tgcounts[105][105];
i64 bgcounts[105][105];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
i64 n = B.size();
for (int i = 0; i < n; i++)
{
counts[B[i]][T[i]][G[i]]++;
bcounts[B[i]]++;
tcounts[T[i]]++;
gcounts[G[i]]++;
btcounts[B[i]][T[i]]++;
bgcounts[B[i]][G[i]]++;
tgcounts[T[i]][G[i]]++;
}
i64 ans = 0;
for (int i = 1; i <= 100; i++)
{
for (int j = 1; j <= 100; j++)
{
for (int k = 1; k <= 100; k++)
{
i64 pairs = bcounts[i] + tcounts[j] + gcounts[k];
pairs -= btcounts[i][j] + bgcounts[i][k] + tgcounts[j][k];
pairs += counts[i][j][k];
ans += counts[i][j][k] * (pairs - 1);
}
}
}
return ans / 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
512 KB |
Output is correct |
3 |
Correct |
9 ms |
512 KB |
Output is correct |
4 |
Correct |
10 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
2048 KB |
Output is correct |
6 |
Correct |
10 ms |
2944 KB |
Output is correct |
7 |
Correct |
10 ms |
3840 KB |
Output is correct |
8 |
Correct |
11 ms |
512 KB |
Output is correct |
9 |
Correct |
12 ms |
5888 KB |
Output is correct |
10 |
Correct |
13 ms |
5888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
384 KB |
Output is correct |
2 |
Correct |
9 ms |
512 KB |
Output is correct |
3 |
Correct |
9 ms |
512 KB |
Output is correct |
4 |
Correct |
10 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
2048 KB |
Output is correct |
6 |
Correct |
10 ms |
2944 KB |
Output is correct |
7 |
Correct |
10 ms |
3840 KB |
Output is correct |
8 |
Correct |
11 ms |
512 KB |
Output is correct |
9 |
Correct |
12 ms |
5888 KB |
Output is correct |
10 |
Correct |
13 ms |
5888 KB |
Output is correct |
11 |
Correct |
14 ms |
8576 KB |
Output is correct |
12 |
Correct |
20 ms |
1152 KB |
Output is correct |
13 |
Correct |
33 ms |
9076 KB |
Output is correct |
14 |
Correct |
50 ms |
11248 KB |
Output is correct |
15 |
Correct |
68 ms |
12272 KB |
Output is correct |
16 |
Correct |
81 ms |
5224 KB |
Output is correct |
17 |
Correct |
86 ms |
5356 KB |
Output is correct |
18 |
Correct |
88 ms |
7652 KB |
Output is correct |
19 |
Correct |
96 ms |
14056 KB |
Output is correct |
20 |
Correct |
94 ms |
14060 KB |
Output is correct |