Submission #148362

#TimeUsernameProblemLanguageResultExecution timeMemory
148362잉여로운 고3 (#200)FunctionCup Museum (FXCUP4_museum)C++17
100 / 100
107 ms13292 KiB
#include <bits/stdc++.h> #include "museum.h" using namespace std; typedef long long ll; ll X1[111], X2[111], X3[111]; ll Y1[10101], Y2[10101], Y3[10101]; ll Z[1010101]; ll n, ans; ll CountSimilarPairs(vector <int> B, vector <int> T, vector <int> G) { ll i; n = B.size(); for(i=0; i<n; i++){ B[i] --; T[i] --; G[i] --; X1[B[i]] ++; X2[T[i]] ++; X3[G[i]] ++; Y1[B[i] * 100 + T[i]] ++; Y2[T[i] * 100 + G[i]] ++; Y3[G[i] * 100 + B[i]] ++; Z[B[i] * 10000 + T[i] * 100 + G[i]] ++; } for(i=0; i<100; i++){ ans += X1[i] * (X1[i] - 1) / 2; ans += X2[i] * (X2[i] - 1) / 2; ans += X3[i] * (X3[i] - 1) / 2; } for(i=0; i<10000; i++){ ans -= Y1[i] * (Y1[i] - 1) / 2; ans -= Y2[i] * (Y2[i] - 1) / 2; ans -= Y3[i] * (Y3[i] - 1) / 2; } for(i=0; i<1e6; i++){ ans += Z[i] * (Z[i] - 1) / 2; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...