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"
long long int numB[100];
long long int numT[100];
long long int numG[100];
long long int numBT[10000];
long long int numBG[10000];
long long int numTG[10000];
long long int numBTG[1000000];
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++){
B[i]--;
T[i]--;
G[i]--;
numB[B[i]]++;
numT[T[i]]++;
numG[G[i]]++;
numBT[100*B[i]+T[i]]++;
numBG[100*B[i]+G[i]]++;
numTG[100*T[i]+G[i]]++;
numBTG[10000*B[i]+100*T[i]+G[i]]++;
}
long long int ans=0;
for(int i=0; i<100; i++){
ans+=numB[i]*(numB[i]-1)/2;
ans+=numT[i]*(numT[i]-1)/2;
ans+=numG[i]*(numG[i]-1)/2;
}
for(int i=0; i<10000; i++){
ans-=numBT[i]*(numBT[i]-1)/2;
ans-=numBG[i]*(numBG[i]-1)/2;
ans-=numTG[i]*(numTG[i]-1)/2;
}
for(int i=0; i<1000000; i++){
ans+=(numBTG[i])*(numBTG[i]-1)/2;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |