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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
map<int, ll> b, t, g;
map<pii, ll> bt, bg, tg;
map<pipii, ll> btg;
int n = B.size();
ll ret = 0;
for(int i = 0; i < B.size(); i++) {
b[B[i]]++;
t[T[i]]++;
g[G[i]]++;
bt[{B[i], T[i]}]++;
bg[{B[i], G[i]}]++;
tg[{T[i], G[i]}]++;
btg[{B[i], {T[i], G[i]}}]++;
}
for(auto out: b) ret += out.second * (out.second-1) / 2;
for(auto out: t) ret += out.second * (out.second-1) / 2;
for(auto out: g) ret += out.second * (out.second-1) / 2;
for(auto out: bt) ret -= out.second * (out.second-1) / 2;
for(auto out: bg) ret -= out.second * (out.second-1) / 2;
for(auto out: tg) ret -= out.second * (out.second-1) / 2;
for(auto out: btg) ret += out.second * (out.second-1) / 2;
return ret;
}
Compilation message (stderr)
museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:16:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0; i < B.size(); i++) {
~~^~~~~~~~~~
museum.cpp:14:6: warning: unused variable 'n' [-Wunused-variable]
int n = B.size();
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |