Submission #148498

#TimeUsernameProblemLanguageResultExecution timeMemory
148498갓띵건 (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
104 ms13292 KiB
#include "museum.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll cnt1[101], cnt2[101][101], cnt3[101][101][101]; long long CountSimilarPairs(vector<int> B, vector<int> T, vector<int> G) { int n = B.size(); ll ans = 0; for(int i = 0; i < n; i++) { ans += cnt1[B[i]]; cnt1[B[i]]++; } for(int i = 0; i < 101; i++) cnt1[i] = 0; for(int i = 0; i < n; i++) { ans += cnt1[T[i]]; cnt1[T[i]]++; } for(int i = 0; i < 101; i++) cnt1[i] = 0; for(int i = 0; i < n; i++) { ans += cnt1[G[i]]; cnt1[G[i]]++; } for(int i = 0; i < n; i++) { ans -= cnt2[B[i]][T[i]]; cnt2[B[i]][T[i]]++; } for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) cnt2[i][j] = 0; for(int i = 0; i < n; i++) { ans -= cnt2[T[i]][G[i]]; cnt2[T[i]][G[i]]++; } for(int i = 0; i < 101; i++) for(int j = 0; j < 101; j++) cnt2[i][j] = 0; for(int i = 0; i < n; i++) { ans -= cnt2[B[i]][G[i]]; cnt2[B[i]][G[i]]++; } for(int i = 0; i < n; i++) { ans += cnt3[B[i]][T[i]][G[i]]; cnt3[B[i]][T[i]][G[i]]++; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...