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 "museum.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cnt1[101], cnt2[101][101], cnt3[101][101][101];
long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
int n = B.size();
ll ans = 0;
for(int i = 0; i < n; i++) {
ans += cnt1[B[i]];
cnt1[B[i]]++;
}
for(int i = 0; i < 101; i++) cnt1[i] = 0;
for(int i = 0; i < n; i++) {
ans += cnt1[T[i]];
cnt1[T[i]]++;
}
for(int i = 0; i < 101; i++) cnt1[i] = 0;
for(int i = 0; i < n; i++) {
ans += cnt1[G[i]];
cnt1[G[i]]++;
}
for(int i = 0; i < n; i++) {
ans -= cnt2[B[i]][T[i]];
cnt2[B[i]][T[i]]++;
}
for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) cnt2[i][j] = 0;
for(int i = 0; i < n; i++) {
ans -= cnt2[T[i]][G[i]];
cnt2[T[i]][G[i]]++;
}
for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) cnt2[i][j] = 0;
for(int i = 0; i < n; i++) {
ans -= cnt2[B[i]][G[i]];
cnt2[B[i]][G[i]]++;
}
for(int i = 0; i < n; i++) {
ans += cnt3[B[i]][T[i]][G[i]];
cnt3[B[i]][T[i]][G[i]]++;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |