Submission #148934

#TimeUsernameProblemLanguageResultExecution timeMemory
148934Seishun Buta Yarou wa Yumemiru Shoujo no Yume wo Minai (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
93 ms10092 KiB
#include "museum.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back typedef long long ll; typedef pair<int,int> ii; typedef vector<int> vi; typedef unsigned long long ull; typedef long double ld; typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds; int ma[3][111]; int freq[3][111][111]; int s[111][111][111]; ll c(ll n) { return (n*(n-1))/2; } long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) { int n = B.size(); for(int i=0;i<n;i++) { ma[0][B[i]]++; ma[1][T[i]]++; ma[2][G[i]]++; freq[0][T[i]][G[i]]++; freq[1][G[i]][B[i]]++; freq[2][B[i]][T[i]]++; s[B[i]][T[i]][G[i]]++; } ll ans = 0; for(int i=0;i<102;i++) { for(int j=0;j<3;j++) { ans+=c(ma[j][i]); } } for(int a=0;a<3;a++) { for(int i=0;i<102;i++) { for(int j=0;j<102;j++) { ans-=c(freq[a][i][j]); } } } for(int i=0;i<102;i++) { for(int j=0;j<102;j++) { for(int k=0;k<102;k++) { ans+=c(s[i][j][k]); } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...