이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "museum.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll s1(vector<int> A){
map<int, ll> freq;
for(int x : A){
freq[x]++;
}
ll ans = 0;
for(auto r : freq){
ans += r.second * r.second;
}
return ans;
}
ll s2(vector<int> A, vector<int> B){
map<int, ll> freq;
for(int i = 0; i < (int)A.size(); i++){
freq[A[i] + B[i] * 200]++;
}
ll ans = 0;
for(auto r : freq){
ans += r.second * r.second;
}
return ans;
}
ll s3(vector<int> A, vector<int> B, vector<int> C){
map<int, ll> freq;
for(int i = 0; i < (int)A.size(); i++){
freq[A[i] + B[i] * 200 + C[i] * 40000]++;
}
ll ans = 0;
for(auto r : freq){
ans += r.second * r.second;
}
return ans;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
using namespace std;
ll ans = s1(B) + s1(T) + s1(G) - s2(B, T) - s2(B, G) - s2(T, G) + s3(B, T, G);
return (ans - (int)B.size()) / 2;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |