This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "museum.h"
using namespace std;
const int BASE = 101;
long long Count(const vector<int> &v) {
map<int, int> freq;
for (auto &x : v) ++freq[x];
long long ans = 0LL;
for (auto &p : freq) ans += 1LL * p.second * (p.second - 1) / 2LL;
return ans;
}
vector<int> Make(const vector<int> &a, const vector<int> &b) {
vector<int> ret(a.size());
for (int i = 0; i < (int)a.size(); ++i) {
ret[i] = a[i] * BASE + b[i];
}
return ret;
}
long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
long long ans = 0LL;
ans += Count(B);
ans += Count(T);
ans += Count(G);
ans -= Count(Make(B, T));
ans -= Count(Make(B, G));
ans -= Count(Make(T, G));
ans += Count(Make(Make(B, T), G));
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |