Submission #762340

#TimeUsernameProblemLanguageResultExecution timeMemory
762340goodbyehanbyeolFunctionCup Museum (FXCUP4_museum)C++17
100 / 100
52 ms10976 KiB
#include "museum.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; int b[101]; int t[101]; int g[101]; int bt[101][101]; int bg[101][101]; int tg[101][101]; int btg[101][101][101]; ll C2(int x) { return 1ll * x * (x - 1ll) / 2ll; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int N = B.size(); int i; for (i = 0; i < N; i++) { b[B[i]]++; t[T[i]]++; g[G[i]]++; bt[B[i]][T[i]]++; bg[B[i]][G[i]]++; tg[T[i]][G[i]]++; btg[B[i]][T[i]][G[i]]++; } int j, k; ll ans = 0; for (i = 1; i <= 100; i++) { ans += C2(b[i]); ans += C2(t[i]); ans += C2(g[i]); } for (i = 1; i <= 100; i++) for (j = 1; j <= 100; j++) { ans -= C2(bt[i][j]); ans -= C2(bg[i][j]); ans -= C2(tg[i][j]); } for (i = 1; i <= 100; i++) for (j = 1; j <= 100; j++) for (k = 1; k <= 100; k++) ans += C2(btg[i][j][k]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...