이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll cnt1[101], cnt2[101][101], cnt3[101][101][101];
long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) {
int n = B.size();
ll ans = 0;
for(int i = 0; i < n; i++) {
ans += cnt1[B[i]];
cnt1[B[i]]++;
}
for(int i = 0; i < 101; i++) cnt1[i] = 0;
for(int i = 0; i < n; i++) {
ans += cnt1[T[i]];
cnt1[T[i]]++;
}
for(int i = 0; i < 101; i++) cnt1[i] = 0;
for(int i = 0; i < n; i++) {
ans += cnt1[G[i]];
cnt1[G[i]]++;
}
for(int i = 0; i < n; i++) {
ans -= cnt2[B[i]][T[i]];
cnt2[B[i]][T[i]]++;
}
for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) cnt2[i][j] = 0;
for(int i = 0; i < n; i++) {
ans -= cnt2[T[i]][G[i]];
cnt2[T[i]][G[i]]++;
}
for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) cnt2[i][j] = 0;
for(int i = 0; i < n; i++) {
ans -= cnt2[B[i]][G[i]];
cnt2[B[i]][G[i]]++;
}
for(int i = 0; i < n; i++) {
ans += cnt3[B[i]][T[i]][G[i]];
cnt3[B[i]][T[i]][G[i]]++;
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |