Skip to content

Commit 2d6d172

Browse files
Create 19-Museum.cpp
1 parent f07206e commit 2d6d172

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

FunctionCup/19-Museum.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "museum.h"
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
long long CountSimilarPairs(vector<int> b, vector<int> t, vector<int> g) {
6+
long long ans=0;
7+
for(int i=1; i<8; ++i) {
8+
unordered_map<int, int> mp;
9+
for(int j=0; j<b.size(); ++j) {
10+
int k=((i&1?b[j]:0)*101+(i&2?t[j]:0))*101+(i&4?g[j]:0);
11+
ans+=(mp[k]++)*(__builtin_popcount(i)%2*2-1);
12+
}
13+
}
14+
return ans;
15+
}

0 commit comments

Comments
 (0)