#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);
ans+=numT[i]*(numT[i]-1);
ans+=numG[i]*(numG[i]-1);
}
for(int i=0; i<10000; i++){
ans-=numBT[i]*(numBT[i]-1);
ans-=numBG[i]*(numBG[i]-1);
ans-=numTG[i]*(numTG[i]-1);
}
for(int i=0; i<1000000; i++){
ans+=(numBTG[i])*(numBTG[i]-1);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |