Submission #148621

#TimeUsernameProblemLanguageResultExecution timeMemory
148621Little Piplup (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
104 ms13544 KiB
#include "museum.h" long long countB[211],countT[211],countG[211]; long long countBT[20501],countBG[20501],countTG[20501]; long long countBTG[2000101]; 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]*101+T[i]]++; countBG[B[i]*101+G[i]]++; countTG[T[i]*101+G[i]]++; countBTG[B[i]*10201+T[i]*101+G[i]]++; } for (int i = 1; i<=210; i++) { ans += (ct(countB[i])); ans += (ct(countG[i])); ans += (ct(countT[i])); } for (int i = 1; i<=20500; i++) { ans -= ct(countBT[i]); ans -= ct(countBG[i]); ans -= ct(countTG[i]); } for (int i = 1; i<=2000000; i++) ans += ct(countBTG[i]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...