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;
typedef long long LL;
int N;
LL ans;
LL BC[110], TC[110], GC[110];
LL BT[110][110], TG[110][110], BG[110][110];
LL BTG[110][110][110];
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++) {
BC[B[i]]++, TC[T[i]]++, GC[G[i]]++;
BT[B[i]][T[i]]++;
TG[T[i]][G[i]]++;
BG[B[i]][G[i]]++;
BTG[B[i]][T[i]][G[i]]++;
}
for (int i=1; i<=100; i++){
ans += BC[i]*(BC[i]-1)/2;
ans += TC[i]*(TC[i]-1)/2;
ans += GC[i]*(GC[i]-1)/2;
}
for (int i=1; i<=100; i++){
for (int j=1; j<=100; j++){
ans -= BT[i][j]*(BT[i][j]-1)/2;
ans -= TG[i][j]*(TG[i][j]-1)/2;
ans -= BG[i][j]*(BG[i][j]-1)/2;
}
}
for (int i=1; i<=100; i++) for (int j=1; j<=100; j++) for (int k=1; k<=100; k++) ans += BTG[i][j][k]*(BTG[i][j][k]-1)/2;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |