Submission #148440

#TimeUsernameProblemLanguageResultExecution timeMemory
148440팀명못정해서15시간째고민중인팀 (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
98 ms10092 KiB
#include <bits/stdc++.h> #include "museum.h" using namespace std; int O[3][111]; int W[3][111][111]; int C[111][111][111]; long long f(int x) { return 1LL * x * (x-1) / 2; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int N = B.size(); for(int i=0; i<N; i++) { ++O[0][B[i]]; ++O[1][T[i]]; ++O[2][G[i]]; ++W[0][T[i]][G[i]]; ++W[1][B[i]][G[i]]; ++W[2][B[i]][T[i]]; ++C[B[i]][T[i]][G[i]]; } long long ans = 0; for(int i=1; i<=100; i++) { ans += f(O[0][i]); ans += f(O[1][i]); ans += f(O[2][i]); } for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) { ans -= f(W[0][i][j]); ans -= f(W[1][i][j]); ans -= f(W[2][i][j]); } for(int i=1; i<=100; i++) for(int j=1; j<=100; j++) for(int k=1; k<=100; k++) { ans += f(C[i][j][k]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...