Submission #150031

#TimeUsernameProblemLanguageResultExecution timeMemory
150031Ragtag Volunteers (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
510 ms18744 KiB
#include "museum.h" #include <map> #include <utility> #include <tuple> using namespace std; using ll = long long; long long CountSimilarPairs(vector<int> b, vector<int> t, vector<int> g) { const int n = b.size(); ll res = 0; vector v({b, t, g}); for (int i = 0; i < 3; i++) { map<int, int> cnt; for (int e : v[i]) { res += cnt[e]; cnt[e]++; } } for (int i = 0; i < 3; i++) { for (int j = i + 1; j < 3; j++) { map<pair<int, int>, int> cnt; for (int k = 0; k < n; k++) { const pair p(v[i][k], v[j][k]); res -= cnt[p]; cnt[p]++; } } } map<tuple<int, int, int>, int> cnt; for (int i = 0; i < n; i++) { const tuple T(b[i], t[i], g[i]); res += cnt[T]; cnt[T]++; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...