#include "museum.h"
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int N = B.size();
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];
for(int i=0; i<N; 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 |
1 |
Incorrect |
8 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |