# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148417 | Powered By Zigui (#200) | FunctionCup Museum (FXCUP4_museum) | C++17 | 98 ms | 9328 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |