Submission #148591

#TimeUsernameProblemLanguageResultExecution timeMemory
148591koosaga fan club (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
552 ms18404 KiB
#include <bits/stdc++.h> #include "museum.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<int, pii> pipii; long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { map<int, ll> b, t, g; map<pii, ll> bt, bg, tg; map<pipii, ll> btg; int n = B.size(); ll ret = 0; for(int i = 0; i < B.size(); i++) { b[B[i]]++; t[T[i]]++; g[G[i]]++; bt[{B[i], T[i]}]++; bg[{B[i], G[i]}]++; tg[{T[i], G[i]}]++; btg[{B[i], {T[i], G[i]}}]++; } for(auto out: b) ret += out.second * (out.second-1) / 2; for(auto out: t) ret += out.second * (out.second-1) / 2; for(auto out: g) ret += out.second * (out.second-1) / 2; for(auto out: bt) ret -= out.second * (out.second-1) / 2; for(auto out: bg) ret -= out.second * (out.second-1) / 2; for(auto out: tg) ret -= out.second * (out.second-1) / 2; for(auto out: btg) ret += out.second * (out.second-1) / 2; return ret; }

Compilation message (stderr)

museum.cpp: In function 'long long int CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:16:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < B.size(); i++) {
                 ~~^~~~~~~~~~
museum.cpp:14:6: warning: unused variable 'n' [-Wunused-variable]
  int n = B.size();
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...