Submission #148454

#TimeUsernameProblemLanguageResultExecution timeMemory
148454Torat (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
101 ms9324 KiB
#include <bits/stdc++.h> #include "museum.h" //~ #include "grader.cpp" using namespace std; #define ll long long int cnt1[3][101], cnt2[3][101][101], cnt3[101][101][101]; long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int n = B.size(); ll ans = 0; for(int i = n - 1 ; i >= 0 ; i--){ int cur = 0; cur += cnt1[0][B[i]]; cur += cnt1[1][T[i]]; cur += cnt1[2][G[i]]; cur -= cnt2[0][B[i]][T[i]]; cur -= cnt2[1][B[i]][G[i]]; cur -= cnt2[2][T[i]][G[i]]; cur += cnt3[B[i]][T[i]][G[i]]; ans += cur; cnt1[0][B[i]]++; cnt1[1][T[i]]++; cnt1[2][G[i]]++; cnt2[0][B[i]][T[i]]++; cnt2[1][B[i]][G[i]]++; cnt2[2][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...