# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150053 | 강한친구 대한육군 (#200) | FunctionCup Museum (FXCUP4_museum) | C++17 | 81 ms | 7664 KiB |
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<vector>
#include<algorithm>
using namespace std;
int a[102];
int b[102];
int c[102];
int ab[102][102];
int bc[102][102];
int ca[102][102];
int abc[102][102][102];
long long cal(int x) {
long long int res = x;
return x * (x - 1) / 2;
}
long long CountSimilarPairs(std::vector<int> x, std::vector<int> y, std::vector<int> z) {
int n = x.size();
long long int res = 0;
int i, j, k;
for (i = 0; i < n; i++)
{
a[x[i]]++;
b[y[i]]++;
c[z[i]]++;
ab[x[i]][y[i]]++;
bc[y[i]][z[i]]++;
ca[z[i]][x[i]]++;
abc[x[i]][y[i]][z[i]]++;
}
for (i = 1; i <= 100; i++)
{
res += cal(a[i]);
res += cal(b[i]);
res += cal(c[i]);
for (j = 1; j <= 100; j++) {
res -= cal(ab[i][j]);
res -= cal(bc[i][j]);
res -= cal(ca[i][j]);
for (k = 1; k <= 100; k++) {
res += cal(abc[i][j][k]);
}
}
}
return res;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |