Submission #148578

#TimeUsernameProblemLanguageResultExecution timeMemory
148578Little Piplup (#200)FunctionCup Museum (FXCUP4_museum)C++17
0 / 100
11 ms3712 KiB
#include "museum.h" long long countB[111],countT[111],countG[111]; long long countBT[10101],countBG[10101],countTG[10101]; long long countBTG[1010101]; inline long long ct(long long x) { return x*(x-1)/2; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int N = B.size(); long long ans = 0; for (int i = 0; i<N; i++) { countB[B[i]]++; countT[T[i]]++; countG[G[i]]++; countBT[B[i]*100+T[i]]++; countBG[B[i]*100+G[i]]++; countTG[T[i]*100+G[i]]++; countBTG[B[i]*10000+T[i]*100+G[i]]++; } for (int i = 1; i<=100; i++) { ans += (ct(countB[i])); ans += (ct(countG[i])); ans += (ct(countT[i])); } for (int i = 1; i<=10000; i++) { ans -= ct(countBT[i]); ans -= ct(countBG[i]); ans -= ct(countTG[i]); } for (int i = 1; i<=1000000; i++) ans += ct(countBTG[i]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...