Submission #148463

#TimeUsernameProblemLanguageResultExecution timeMemory
148463샌즈뼈 (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
362 ms17744 KiB
#include "museum.h" #include <bits/stdc++.h> using namespace std; #define ll long long template<typename T> ll f(vector<T> v) { map<T, int> s; for(auto x : v) s[x] += 1; ll r = 0; for(auto p : s) { ll t = p.second; r += (t * (t - 1)) / 2; } return r; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int N = B.size(); ll r = 0; r += f(B); r += f(T); r += f(G); vector<int> BT, TG, BG, BTG; for(int i=0; i<N; i++) { BT.push_back(B[i]*1000 + T[i]); TG.push_back(T[i]*1000 + G[i]); BG.push_back(B[i]*1000 + G[i]); BTG.push_back(B[i]*1000000 + T[i]*1000 + G[i]); } r -= f(BT); r -= f(TG); r -= f(BG); r += f(BTG); return r; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...