Submission #148423

#TimeUsernameProblemLanguageResultExecution timeMemory
148423CHT를 사랑하는 모임 (#200)FunctionCup Museum (FXCUP4_museum)C++17
0 / 100
9 ms512 KiB
#include "museum.h" #include <bits/stdc++.h> #define fi first #define se second using namespace std; typedef long long ll; typedef long double db; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<db,db> pdb; typedef tuple<int,int,int,int> TP; typedef vector<vector<ll>> mat; const int N=105; const ll mod=1e9+7; int n; ll ans,b[N],t[N],g[N],bt[N][N],tg[N][N],bg[N][N],btg[N][N][N]; long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { n=B.size(); for(int i=0;i<n;i++){ b[B[i]]++; t[T[i]]++; g[G[i]]++; bt[B[i]][T[i]]++; tg[T[i]][G[i]]++; bg[B[i]][G[i]]++; btg[B[i]][T[i]][G[i]]++; } for(int i=1;i<=100;i++){ ans+=b[i]*(b[i]-1LL)/2LL; ans+=g[i]*(g[i]-1LL)/2LL; ans+=t[i]*(t[i]-1LL)/2LL; } for(int i=1;i<=100;i++) for(int j=1;j<=100;j++){ ans-=bt[i][j]*(bt[i][j]-1LL)/2LL; ans-=tg[i][j]*(tg[i][j]-1LL)/2LL; ans-=bg[i][j]*(bg[i][j]-1LL)/2LL; } for(int i=1;i<=100;i++) for(int j=1;j<=100;j++) for(int k=1;k<=100;k++){ ans+=btg[i][j][k]*(btg[i][j][k]-1LL); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...