Submission #148099

# Submission time Handle Problem Language Result Execution time Memory
148099 2019-08-31T13:53:56 Z 조팍시\n123(#3740, tlwpdus, ainta, cki86201) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
252 ms 13096 KB
#include <bits/stdc++.h>
#include "museum.h"
using namespace std;

#define Fi first
#define Se second
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3;

ll Get(vector <int> &A, vector <int> &B, vector <int> &C) {
	vector <t3> V;
	int n = szz(A);
	rep(i, n) V.emplace_back(A[i], B[i], C[i]);
	ll ans = 0;
	sort(all(V));
	for(int i=0, j=0;i<n;i++) {
		if(i == n-1 || V[i] != V[i+1]) {
			ans += (ll)(j-i) * (j-i-1) / 2;
			j = i + 1;
		}
	}
	return ans;
}

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	vector <int> I;
	int N = szz(B);
	rep(i, N) I.pb(0);
	ll ans = 0;
	ans = Get(B, I, I) + Get(T, I, I) + Get(G, I, I) - Get(B, T, I) - Get(B, G, I) - Get(G, T, I) + Get(B, T, G);
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 372 KB Output is correct
11 Correct 8 ms 760 KB Output is correct
12 Correct 28 ms 2236 KB Output is correct
13 Correct 68 ms 3852 KB Output is correct
14 Correct 104 ms 5836 KB Output is correct
15 Correct 153 ms 7804 KB Output is correct
16 Correct 152 ms 12576 KB Output is correct
17 Correct 214 ms 12616 KB Output is correct
18 Correct 244 ms 13040 KB Output is correct
19 Correct 252 ms 13044 KB Output is correct
20 Correct 252 ms 13096 KB Output is correct