Submission #148417

#TimeUsernameProblemLanguageResultExecution timeMemory
148417Powered By Zigui (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
98 ms9328 KiB
#include "museum.h" using namespace std; vector<int> b(101), t(101), g(101), bt(10101), tg(10101), bg(10101), btg(1010101); int calc(int bb, int tt, int gg) { return bb + 100*tt + 10000*gg; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { for(int i=0;i<B.size();i++) { B[i]--; G[i]--; T[i]--; } for(int i=0;i<B.size();i++) { b[B[i]]++; t[T[i]]++; g[G[i]]++; bt[100 * B[i] + T[i]]++; tg[100 * T[i] + G[i]]++; bg[100 * B[i] + G[i]]++; btg[10000 * B[i] + 100 * T[i] + G[i]]++; } long long ans = 0; for(int i=0;i<=100;i++) { ans += 1LL * b[i] * (b[i]-1) / 2LL; ans += 1LL * t[i] * (t[i]-1) / 2LL; ans += 1LL * g[i] * (g[i]-1) / 2LL; } for(int i=0;i<=10000;i++) { ans -= 1LL * bt[i] * (bt[i]-1) / 2LL; ans -= 1LL * tg[i] * (tg[i]-1) / 2LL; ans -= 1LL * bg[i] * (bg[i]-1) / 2LL; } for(int i=0;i<=1000000;i++) { ans += 1LL * btg[i] * (btg[i]-1) / 2LL; } return ans; }

Compilation message (stderr)

museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:10:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<B.size();i++)
                 ~^~~~~~~~~
museum.cpp:16:18: 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...