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>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
ll const inf = 1e9;
ll const mod = 1e9 + 7;
ld const eps = 1e-9;
#include "museum.h"
ll _1[101];
ll _2[101];
ll _3[101];
ll _12[101][101];
ll _13[101][101];
ll _23[101][101];
ll cnt[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;
fr(i, 0, N){
if(i > 0){
ans += _1[B[i]] + _2[T[i]] + _3[G[i]] - _12[B[i]][T[i]] - _13[B[i]][G[i]] - _23[T[i]][G[i]] + cnt[B[i]][T[i]][G[i]];
}
_1[B[i]] ++;
_2[T[i]] ++;
_3[G[i]] ++;
_12[B[i]][T[i]] ++;
_13[B[i]][G[i]] ++;
_23[T[i]][G[i]] ++;
cnt[B[i]][T[i]][G[i]] ++;
}
return ans;
}
/*
int main()
{
cout << CountSimilarPairs({1, 2, 3, 4, 1}, {1, 2, 1, 2, 1}, {1, 1, 2, 2, 3}) << endl;
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |