#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)/2LL;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
500 KB |
Output is correct |
3 |
Correct |
9 ms |
512 KB |
Output is correct |
4 |
Correct |
8 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
2048 KB |
Output is correct |
6 |
Correct |
10 ms |
2816 KB |
Output is correct |
7 |
Correct |
11 ms |
3840 KB |
Output is correct |
8 |
Correct |
10 ms |
512 KB |
Output is correct |
9 |
Correct |
12 ms |
5760 KB |
Output is correct |
10 |
Correct |
11 ms |
5760 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
384 KB |
Output is correct |
2 |
Correct |
8 ms |
500 KB |
Output is correct |
3 |
Correct |
9 ms |
512 KB |
Output is correct |
4 |
Correct |
8 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
2048 KB |
Output is correct |
6 |
Correct |
10 ms |
2816 KB |
Output is correct |
7 |
Correct |
11 ms |
3840 KB |
Output is correct |
8 |
Correct |
10 ms |
512 KB |
Output is correct |
9 |
Correct |
12 ms |
5760 KB |
Output is correct |
10 |
Correct |
11 ms |
5760 KB |
Output is correct |
11 |
Correct |
13 ms |
8704 KB |
Output is correct |
12 |
Correct |
22 ms |
1144 KB |
Output is correct |
13 |
Correct |
33 ms |
9080 KB |
Output is correct |
14 |
Correct |
44 ms |
11248 KB |
Output is correct |
15 |
Correct |
63 ms |
12272 KB |
Output is correct |
16 |
Correct |
79 ms |
5224 KB |
Output is correct |
17 |
Correct |
80 ms |
5352 KB |
Output is correct |
18 |
Correct |
87 ms |
7656 KB |
Output is correct |
19 |
Correct |
93 ms |
14092 KB |
Output is correct |
20 |
Correct |
89 ms |
14108 KB |
Output is correct |