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 <bits/stdc++.h>
#include "museum.h"
using namespace std;
int O[3][111];
int W[3][111][111];
int C[111][111][111];
long long f(int x) {
return 1LL * x * (x-1) / 2;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
for(int i=0; i<N; i++) {
++O[0][B[i]];
++O[1][T[i]];
++O[2][G[i]];
++W[0][T[i]][G[i]];
++W[1][B[i]][G[i]];
++W[2][B[i]][T[i]];
++C[B[i]][T[i]][G[i]];
}
long long ans = 0;
for(int i=1; i<=100; i++) {
ans += f(O[0][i]);
ans += f(O[1][i]);
ans += f(O[2][i]);
}
for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) {
ans -= f(W[0][i][j]);
ans -= f(W[1][i][j]);
ans -= f(W[2][i][j]);
}
for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) for(int k=1; k<=100; k++) {
ans += f(C[i][j][k]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |