#include "museum.h"
#include <cstdio>
#include <iostream>
#include <string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
const int INF = 1e9 + 7;
const int MAX = 4005;
long long CountSimilarPairs(std::vector<int> a, std::vector<int> b, std::vector<int> c) {
int n = a.size();
ll x[101] = { 0 }, y[101] = { 0 }, z[101] = { 0 };
ll xy[10001] = { 0 }, yz[10001] = { 0 }, zx[10001] = { 0 };
ll xyz[1000001] = { 0 };
for (int i = 0; i < n; i++) {
int aa, bb, cc;
aa = a[i]-1;
bb = b[i]-1;
cc = c[i]-1;
x[aa] ++;
y[bb] ++;
z[cc] ++;
xy[aa * 100 + bb] ++;
yz[bb * 100 + cc] ++;
zx[cc * 100 + aa] ++;
xyz[aa * 10000 + bb * 100 + cc] ++;
}
ll ans = 0;
for (int i = 0; i < 100; i++) {
ans += x[i] * (x[i] - 1) / 2;
ans += y[i] * (y[i] - 1) / 2;
ans += z[i] * (z[i] - 1) / 2;
}
for (int i = 0; i < 10000; i++) {
ans -= xy[i] * (xy[i] - 1) / 2;
ans -= yz[i] * (yz[i] - 1) / 2;
ans -= zx[i] * (zx[i] - 1) / 2;
}
for (int i = 0; i < 1000000; i++) {
ans += xyz[i] * (xyz[i] - 1) / 2;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
8448 KB |
Output is correct |
2 |
Correct |
11 ms |
8448 KB |
Output is correct |
3 |
Correct |
11 ms |
8448 KB |
Output is correct |
4 |
Correct |
12 ms |
8448 KB |
Output is correct |
5 |
Correct |
11 ms |
8448 KB |
Output is correct |
6 |
Correct |
11 ms |
8448 KB |
Output is correct |
7 |
Correct |
11 ms |
8448 KB |
Output is correct |
8 |
Correct |
14 ms |
8448 KB |
Output is correct |
9 |
Correct |
12 ms |
8448 KB |
Output is correct |
10 |
Correct |
12 ms |
8448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
8448 KB |
Output is correct |
2 |
Correct |
11 ms |
8448 KB |
Output is correct |
3 |
Correct |
11 ms |
8448 KB |
Output is correct |
4 |
Correct |
12 ms |
8448 KB |
Output is correct |
5 |
Correct |
11 ms |
8448 KB |
Output is correct |
6 |
Correct |
11 ms |
8448 KB |
Output is correct |
7 |
Correct |
11 ms |
8448 KB |
Output is correct |
8 |
Correct |
14 ms |
8448 KB |
Output is correct |
9 |
Correct |
12 ms |
8448 KB |
Output is correct |
10 |
Correct |
12 ms |
8448 KB |
Output is correct |
11 |
Correct |
16 ms |
8576 KB |
Output is correct |
12 |
Correct |
22 ms |
9216 KB |
Output is correct |
13 |
Correct |
42 ms |
9844 KB |
Output is correct |
14 |
Correct |
48 ms |
10480 KB |
Output is correct |
15 |
Correct |
62 ms |
11500 KB |
Output is correct |
16 |
Correct |
78 ms |
13292 KB |
Output is correct |
17 |
Correct |
88 ms |
13292 KB |
Output is correct |
18 |
Correct |
90 ms |
13292 KB |
Output is correct |
19 |
Correct |
110 ms |
13292 KB |
Output is correct |
20 |
Correct |
102 ms |
13292 KB |
Output is correct |