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;
ll X1[111], X2[111], X3[111];
ll Y1[10101], Y2[10101], Y3[10101];
ll Z[1010101];
ll n, ans;
ll CountSimilarPairs(vector <int> B, vector <int> T, vector <int> G)
{
ll i;
n = B.size();
for(i=0; i<n; i++){
B[i] --; T[i] --; G[i] --;
X1[B[i]] ++; X2[T[i]] ++; X3[G[i]] ++;
Y1[B[i] * 100 + T[i]] ++; Y2[T[i] * 100 + G[i]] ++; Y3[G[i] * 100 + B[i]] ++;
Z[B[i] * 10000 + T[i] * 100 + G[i]] ++;
}
for(i=0; i<100; i++){
ans += X1[i] * (X1[i] - 1) / 2;
ans += X2[i] * (X2[i] - 1) / 2;
ans += X3[i] * (X3[i] - 1) / 2;
}
for(i=0; i<10000; i++){
ans -= Y1[i] * (Y1[i] - 1) / 2;
ans -= Y2[i] * (Y2[i] - 1) / 2;
ans -= Y3[i] * (Y3[i] - 1) / 2;
}
for(i=0; i<1e6; i++){
ans += Z[i] * (Z[i] - 1) / 2;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |