#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
const int R = 101;
typedef long long ll;
int cnt[R*R*R+2];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G)
{
int n = B.size(), i, j;
for(i=0; i<n; ++i)
{
for(j=1; j<(1<<3); ++j)
{
int bb, tt, gg;
if(j & 1) bb = B[i];
else bb = 0;
if(j & 2) tt = T[i];
else tt = 0;
if(j & 4) gg = G[i];
else gg = 0;
int nr = (R * R * bb) + (R * tt) + gg;
++cnt[nr];
}
}
ll ans = 0;
for(i=1; i<=R*R*R; ++i)
{
int cntt = (i/R/R > 0) + (i / R % R > 0) + (i % R > 0);
if(cntt & 1) ans += (ll) cnt[i] * cnt[i];
else ans -= (ll) cnt[i] * cnt[i];
}
ans -= n;
ans /= 2;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
17 ms |
384 KB |
Output is correct |
3 |
Correct |
12 ms |
512 KB |
Output is correct |
4 |
Correct |
13 ms |
640 KB |
Output is correct |
5 |
Correct |
13 ms |
2048 KB |
Output is correct |
6 |
Correct |
15 ms |
2176 KB |
Output is correct |
7 |
Correct |
13 ms |
3072 KB |
Output is correct |
8 |
Correct |
12 ms |
512 KB |
Output is correct |
9 |
Correct |
16 ms |
4096 KB |
Output is correct |
10 |
Correct |
14 ms |
3968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
17 ms |
384 KB |
Output is correct |
3 |
Correct |
12 ms |
512 KB |
Output is correct |
4 |
Correct |
13 ms |
640 KB |
Output is correct |
5 |
Correct |
13 ms |
2048 KB |
Output is correct |
6 |
Correct |
15 ms |
2176 KB |
Output is correct |
7 |
Correct |
13 ms |
3072 KB |
Output is correct |
8 |
Correct |
12 ms |
512 KB |
Output is correct |
9 |
Correct |
16 ms |
4096 KB |
Output is correct |
10 |
Correct |
14 ms |
3968 KB |
Output is correct |
11 |
Correct |
15 ms |
4608 KB |
Output is correct |
12 |
Correct |
26 ms |
1152 KB |
Output is correct |
13 |
Correct |
39 ms |
5500 KB |
Output is correct |
14 |
Correct |
56 ms |
6508 KB |
Output is correct |
15 |
Correct |
76 ms |
7408 KB |
Output is correct |
16 |
Correct |
93 ms |
5224 KB |
Output is correct |
17 |
Correct |
96 ms |
5228 KB |
Output is correct |
18 |
Correct |
103 ms |
6500 KB |
Output is correct |
19 |
Correct |
107 ms |
9220 KB |
Output is correct |
20 |
Correct |
109 ms |
9216 KB |
Output is correct |