Submission #150902

#TimeUsernameProblemLanguageResultExecution timeMemory
150902Alexa2001FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
91 ms10360 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...