We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f07206e commit 2d6d172Copy full SHA for 2d6d172
FunctionCup/19-Museum.cpp
@@ -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