Submission #148565

#TimeUsernameProblemLanguageResultExecution timeMemory
148565Weeeee (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
109 ms9220 KiB
#include "museum.h" #include <bits/stdc++.h> using namespace std; const int R = 101; typedef long long ll; int cnt[R*R*R+2]; long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int n = B.size(), i, j; for(i=0; i<n; ++i) { for(j=1; j<(1<<3); ++j) { int bb, tt, gg; if(j & 1) bb = B[i]; else bb = 0; if(j & 2) tt = T[i]; else tt = 0; if(j & 4) gg = G[i]; else gg = 0; int nr = (R * R * bb) + (R * tt) + gg; ++cnt[nr]; } } ll ans = 0; for(i=1; i<=R*R*R; ++i) { int cntt = (i/R/R > 0) + (i / R % R > 0) + (i % R > 0); if(cntt & 1) ans += (ll) cnt[i] * cnt[i]; else ans -= (ll) cnt[i] * cnt[i]; } ans -= n; ans /= 2; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...