Submission #151971

#TimeUsernameProblemLanguageResultExecution timeMemory
151971minty99FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
78 ms11108 KiB
#include "museum.h" #include <stdio.h> int B_only[101], T_only[101], G_only[101]; int BT[101][101], BG[101][101], TG[101][101]; int BTG[101][101][101]; long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { for(int i = 0; i < B.size(); i++) { int b = B[i], t = T[i], g = G[i]; B_only[b]++; T_only[t]++; G_only[g]++; BT[b][t]++; BG[b][g]++; TG[t][g]++; BTG[b][t][g]++; } long long answer = 0; for(int i = 0; i < B.size(); i++) { int b = B[i], t = T[i], g = G[i]; int nA = B_only[b]; int nB = T_only[t]; int nC = G_only[g]; int nAB = BT[b][t]; int nAC = BG[b][g]; int nBC = TG[t][g]; int nABC = BTG[b][t][g]; long long ans = (long long) nA + nB + nC - nAB - nBC - nAC + nABC - 1; answer += ans; } return answer / 2; }

Compilation message (stderr)

museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:8:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < B.size(); i++)
                 ~~^~~~~~~~~~
museum.cpp:21:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < B.size(); i++)
                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...