#include "museum.h"
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<db,db> pdb;
typedef tuple<int,int,int,int> TP;
typedef vector<vector<ll>> mat;
const int N=105;
const ll mod=1e9+7;
int n;
ll ans,b[N],t[N],g[N],bt[N][N],tg[N][N],bg[N][N],btg[N][N][N];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
n=B.size();
for(int i=0;i<n;i++){
b[B[i]]++; t[T[i]]++; g[G[i]]++;
bt[B[i]][T[i]]++; tg[T[i]][G[i]]++; bg[B[i]][G[i]]++;
btg[B[i]][T[i]][G[i]]++;
}
for(int i=1;i<=100;i++){
ans+=b[i]*(b[i]-1LL)/2LL;
ans+=g[i]*(g[i]-1LL)/2LL;
ans+=t[i]*(t[i]-1LL)/2LL;
}
for(int i=1;i<=100;i++) for(int j=1;j<=100;j++){
ans-=bt[i][j]*(bt[i][j]-1LL)/2LL;
ans-=tg[i][j]*(tg[i][j]-1LL)/2LL;
ans-=bg[i][j]*(bg[i][j]-1LL)/2LL;
}
for(int i=1;i<=100;i++) for(int j=1;j<=100;j++) for(int k=1;k<=100;k++){
ans+=btg[i][j][k]*(btg[i][j][k]-1LL);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
512 KB |
Output is correct |
3 |
Incorrect |
9 ms |
512 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
512 KB |
Output is correct |
3 |
Incorrect |
9 ms |
512 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |