Submission #173882

# Submission time Handle Problem Language Result Execution time Memory
173882 2020-01-05T17:40:24 Z 조팍시\n123(#3740, tlwpdus, ainta, cki86201) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
253 ms 13196 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 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 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 380 KB Output is correct
8 Correct 4 ms 504 KB Output is correct
9 Correct 4 ms 504 KB Output is correct
10 Correct 4 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 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 380 KB Output is correct
8 Correct 4 ms 504 KB Output is correct
9 Correct 4 ms 504 KB Output is correct
10 Correct 4 ms 376 KB Output is correct
11 Correct 8 ms 760 KB Output is correct
12 Correct 28 ms 2196 KB Output is correct
13 Correct 68 ms 3852 KB Output is correct
14 Correct 102 ms 5792 KB Output is correct
15 Correct 151 ms 7892 KB Output is correct
16 Correct 147 ms 12476 KB Output is correct
17 Correct 212 ms 12536 KB Output is correct
18 Correct 240 ms 12996 KB Output is correct
19 Correct 253 ms 13196 KB Output is correct
20 Correct 251 ms 13080 KB Output is correct