Submission #148499

#TimeUsernameProblemLanguageResultExecution timeMemory
148499ummm (#200)FunctionCup Museum (FXCUP4_museum)C++17
27 / 100
1100 ms2424 KiB
#include "museum.h" #include <bits/stdc++.h> using namespace std; long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) { int N = B.size(); vector<vector<int> > v; v.push_back(B); v.push_back(T); v.push_back(G); long long ans = 0; for(int i = 0; i < 3; i++) { multiset<int> m; for(int j = 0; j < N; j++) { ans += m.count(v[i][j]); m.insert(v[i][j]); } } for(int i = 0; i < 3; i++) { multiset<pair<int,int> > m; for(int j = 0; j < N; j++) { ans -= m.count({v[(i+1)%3][j], v[(i+2)%3][j]}); m.insert({v[(i+1)%3][j], v[(i+2)%3][j]}); } } multiset<pair<pair<int,int>, int> > m; for(int i = 0; i < N; i++) { ans += m.count({{v[0][i], v[1][i]}, v[2][i]}); m.insert({{v[0][i], v[1][i]}, v[2][i]}); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...