Submission #148396

#TimeUsernameProblemLanguageResultExecution timeMemory
148396본인 방금 올솔하는 상상함 (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
102 ms13288 KiB
#include "museum.h" long long cnt1[101],cnt2[101][101],cnt3[101][101][101]; long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int N = B.size(); long long ret=0; for(auto i:B) cnt1[i]++; for(int i=1;i<=100;i++){ ret = ret+cnt1[i]*(cnt1[i]-1)/2; cnt1[i]=0; } for(auto i:T) cnt1[i]++; for(int i=1;i<=100;i++){ ret = ret+cnt1[i]*(cnt1[i]-1)/2; cnt1[i]=0; } for(auto i:G) cnt1[i]++; for(int i=1;i<=100;i++){ ret = ret+cnt1[i]*(cnt1[i]-1)/2; cnt1[i]=0; } for(int i=0;i<N;i++) cnt2[B[i]][T[i]]++; for(int i=1;i<=100;i++){ for(int j=1;j<=100;j++){ ret = ret-cnt2[i][j]*(cnt2[i][j]-1)/2; cnt2[i][j]=0; } } for(int i=0;i<N;i++) cnt2[B[i]][G[i]]++; for(int i=1;i<=100;i++){ for(int j=1;j<=100;j++){ ret = ret-cnt2[i][j]*(cnt2[i][j]-1)/2; cnt2[i][j]=0; } } for(int i=0;i<N;i++) cnt2[T[i]][G[i]]++; for(int i=1;i<=100;i++){ for(int j=1;j<=100;j++){ ret = ret-cnt2[i][j]*(cnt2[i][j]-1)/2; cnt2[i][j]=0; } } for(int i=0;i<N;i++){ cnt3[B[i]][T[i]][G[i]]++; } for(int i=1;i<=100;i++){ for(int j=1;j<=100;j++){ for(int k=1;k<=100;k++){ ret = ret+cnt3[i][j][k]*(cnt3[i][j][k]-1)/2; } } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...