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"
//~ #include "grader.cpp"
using namespace std;
#define ll long long
int cnt1[3][101], cnt2[3][101][101], cnt3[101][101][101];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
int n = B.size();
ll ans = 0;
for(int i = n - 1 ; i >= 0 ; i--){
int cur = 0;
cur += cnt1[0][B[i]];
cur += cnt1[1][T[i]];
cur += cnt1[2][G[i]];
cur -= cnt2[0][B[i]][T[i]];
cur -= cnt2[1][B[i]][G[i]];
cur -= cnt2[2][T[i]][G[i]];
cur += cnt3[B[i]][T[i]][G[i]];
ans += cur;
cnt1[0][B[i]]++;
cnt1[1][T[i]]++;
cnt1[2][G[i]]++;
cnt2[0][B[i]][T[i]]++;
cnt2[1][B[i]][G[i]]++;
cnt2[2][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... |