제출 #150794

#제출 시각아이디문제언어결과실행 시간메모리
15079420190901 (#200)FunctionCup Museum (FXCUP4_museum)C++17
0 / 100
6 ms384 KiB
#include "museum.h" #include <vector> #include <map> using namespace std; using ll = long long; int arr1[101]; int arr2[101]; int arr3[101]; ll fac[101]; ll CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) { fac[0] = 1; for (int i = 1; i < 101; i++) fac[i] = fac[i - 1] * i; ll ans = 0; int n = (int)B.size(); for (int i = 0; i < n; i++) arr1[B[i]]++; for (int i = 0; i < n; i++) arr2[T[i]]++; for (int i = 0; i < n; i++) arr3[G[i]]++; for (int i = 0; i < 101; i++) if (arr1[i] > 1) ans += arr1[i] * (arr1[i] - 1) / 2; for (int i = 0; i < 101; i++) if (arr2[i] > 1) ans += arr2[i] * (arr2[i] - 1) / 2; for (int i = 0; i < 101; i++) if (arr3[i] > 1) ans += arr2[i] * (arr2[i] - 1) / 2; map<pair<int, int>, ll> m; for (int i = 0; i < n; i++) m[{ B[i], T[i] }]++; ll tmp = 0; for (auto[key, val] : m) tmp += (val * (val - 1)) / 2; ans -= tmp; m.clear(); for (int i = 0; i < n; i++) m[{ G[i], T[i] }]++; tmp = 0; for (auto[key, val] : m) tmp += (val * (val - 1)) / 2; ans -= tmp; m.clear(); for (int i = 0; i < n; i++) m[{ B[i], G[i] }]++; tmp = 0; for (auto[key, val] : m) tmp += (val * (val - 1)) / 2; ans -= tmp; map<pair<int, pair<int, int>>, ll> m2; for (int i = 0; i < n; i++) m2[{ B[i], { T[i], G[i] } }]++; tmp = 0; for (auto[key, val] : m) tmp += (val * (val - 1)) / 2; ans -= tmp; return ans; }

컴파일 시 표준 에러 (stderr) 메시지

museum.cpp: In function 'll CountSimilarPairs(std::vector<int>, std::vector<int>, std::vector<int>)':
museum.cpp:48:20: warning: unused variable 'key' [-Wunused-variable]
  for (auto[key, val] : m)
                    ^
museum.cpp:57:20: warning: unused variable 'key' [-Wunused-variable]
  for (auto[key, val] : m)
                    ^
museum.cpp:66:20: warning: unused variable 'key' [-Wunused-variable]
  for (auto[key, val] : m)
                    ^
museum.cpp:75:20: warning: unused variable 'key' [-Wunused-variable]
  for (auto[key, val] : m)
                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...