이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |