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>
#define sz(x) ((int)x.size())
#define pb push_back
#define ii pair<int,int>
#define st first
#define nd second
#define ll long long
#define N 200005
#define inf 1000000000
#define MOD 1000000007
using namespace std;
int n;
int cnt1[3][105],cnt2[3][105][105],cnt3[105][105][105];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
ll ans=0;
n=sz(B);
for(int i=0;i<n;i++) {
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]]++;
}
for(int i=0;i<3;i++) {
for(int j=1;j<=100;j++) {
ans+=(ll)cnt1[i][j]*(cnt1[i][j]-1)/2;
}
}
for(int i=0;i<3;i++) {
for(int k=1;k<=100;k++) {
for(int l=1;l<=100;l++) {
ans-=(ll)cnt2[i][k][l]*(cnt2[i][k][l]-1)/2;
}
}
}
for(int i=1;i<=100;i++) {
for(int j=1;j<=100;j++) {
for(int k=1;k<=100;k++) {
ans+=(ll)cnt3[i][j][k]*(cnt3[i][j][k]-1)/2;
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |