# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
148890 | 2019-09-01T05:19:23 Z | graneli(#3789, toloraia) | 함수컵 박물관 (FXCUP4_museum) | C++17 | 0 ms | 0 KB |
#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<ll> a, std::vector<ll> b, std::vector<ll> 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; }