Submission #148909

#TimeUsernameProblemLanguageResultExecution timeMemory
148909Avengers (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
96 ms13416 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x),end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; ll const inf = 1e9; ll const mod = 1e9 + 7; ld const eps = 1e-9; #include "museum.h" ll _1[101]; ll _2[101]; ll _3[101]; ll _12[101][101]; ll _13[101][101]; ll _23[101][101]; ll cnt[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; fr(i, 0, N){ if(i > 0){ ans += _1[B[i]] + _2[T[i]] + _3[G[i]] - _12[B[i]][T[i]] - _13[B[i]][G[i]] - _23[T[i]][G[i]] + cnt[B[i]][T[i]][G[i]]; } _1[B[i]] ++; _2[T[i]] ++; _3[G[i]] ++; _12[B[i]][T[i]] ++; _13[B[i]][G[i]] ++; _23[T[i]][G[i]] ++; cnt[B[i]][T[i]][G[i]] ++; } return ans; } /* int main() { cout << CountSimilarPairs({1, 2, 3, 4, 1}, {1, 2, 1, 2, 1}, {1, 1, 2, 2, 3}) << endl; return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...