제출 #148903

#제출 시각아이디문제언어결과실행 시간메모리
148903graneli (#200)함수컵 박물관 (FXCUP4_museum)C++17
100 / 100
126 ms13292 KiB
#include "museum.h" #include <bits/stdc++.h> #define F first #define S second #define mp make_pair #define pb push_back //#define ll __int128 #define ll long long #define LEFT(a) ((a)<<1) #define RIGHT(a) (LEFT(a) + 1) #define MID(a,b) ((a+b)>>1) #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define y1 y122 using namespace std; const ll N = 1000005; int n; ll ans; ll A[N], B[N], C[N]; ll AB[N], BC[N], CA[N]; ll ABC[N]; ll CountSimilarPairs(std::vector<int> a, std::vector<int> b, std::vector<int> c) { n = (int)a.size(); for (int i = 0; i < n; i++){ a[i]--; b[i]--; c[i]--; ll ab = a[i] * 100 + b[i]; ll bc = b[i] * 100 + c[i]; ll ca = c[i] * 100 + a[i]; ll abc = a[i] * 10000 + b[i] * 100 + c[i]; ans += A[a[i]] + B[b[i]] + C[c[i]] - AB[ab] - BC[bc] - CA[ca] + ABC[abc]; A[a[i]]++; B[b[i]]++; C[c[i]]++; AB[ab]++; BC[bc]++; CA[ca]++; ABC[abc]++; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...