Submission #148965

# Submission time Handle Problem Language Result Execution time Memory
148965 2019-09-01T05:28:40 Z usa1+samsung2(#3703, adman, nona1314, wowoto9772) FunctionCup Museum (FXCUP4_museum) C++17
0 / 100
10 ms 8704 KB
#include "museum.h"
#include <algorithm>

long long b[105] = { 0 }, t[105] = { 0 }, g[105] = { 0 };
long long bb[101 * 101] = { 0 }, tt[101 * 101] = { 0 }, gg[101 * 101] = { 0 };
long long tot[101 * 101 * 101] = { 0 };

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {

	for (int i = 0; i < 101 * 101 * 101; i++) tot[i] = 0;
	for (int i = 0; i < 101 * 101; i++) bb[i] = tt[i] = gg[i] = 0;
	for (int i = 0; i < 105; i++) b[i] = t[i] = g[i] = 0;

	long long n = B.size();
	
	long long ans = 0;

	for (int i = 0; i < n; i++) {
		ans += b[B[i]] + t[T[i]] + g[G[i]] - bb[B[i] * T[i]] - tt[T[i] * G[i]] - gg[B[i] * G[i]] + tot[B[i] * T[i] * B[i]];
		b[B[i]]++;
		t[T[i]]++;
		g[G[i]]++;
		bb[B[i] * T[i]]++;
		tt[T[i] * G[i]]++;
		gg[B[i] * G[i]]++;
		tot[B[i] * T[i] * B[i]]++;
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 8704 KB Output is correct
2 Incorrect 10 ms 8704 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 8704 KB Output is correct
2 Incorrect 10 ms 8704 KB Output isn't correct
3 Halted 0 ms 0 KB -