This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |