답안 #148621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148621 2019-09-01T04:47:17 Z Little Piplup(#3742, gratus907, DHdroid, coffeetea99) 함수컵 박물관 (FXCUP4_museum) C++17
100 / 100
104 ms 13544 KB
#include "museum.h"

long long countB[211],countT[211],countG[211];
long long countBT[20501],countBG[20501],countTG[20501];
long long countBTG[2000101];
inline long long ct(long long x)
{
	return x*(x-1)/2;
}
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	long long ans = 0;
	for (int i = 0; i<N; i++)
	{
		countB[B[i]]++;
		countT[T[i]]++;
		countG[G[i]]++;
		countBT[B[i]*101+T[i]]++;
		countBG[B[i]*101+G[i]]++;
		countTG[T[i]*101+G[i]]++;
		countBTG[B[i]*10201+T[i]*101+G[i]]++;
	}
	for (int i = 1; i<=210; i++)
	{
		ans += (ct(countB[i]));
		ans += (ct(countG[i]));
		ans += (ct(countT[i]));
	}
	for (int i = 1; i<=20500; i++)
	{
		ans -= ct(countBT[i]);
		ans -= ct(countBG[i]);
		ans -= ct(countTG[i]);
	}
	for (int i = 1; i<=2000000; i++)
		ans += ct(countBTG[i]);
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 432 KB Output is correct
2 Correct 10 ms 428 KB Output is correct
3 Correct 12 ms 512 KB Output is correct
4 Correct 11 ms 768 KB Output is correct
5 Correct 11 ms 2048 KB Output is correct
6 Correct 12 ms 2944 KB Output is correct
7 Correct 12 ms 3584 KB Output is correct
8 Correct 12 ms 384 KB Output is correct
9 Correct 13 ms 5932 KB Output is correct
10 Correct 13 ms 5760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 432 KB Output is correct
2 Correct 10 ms 428 KB Output is correct
3 Correct 12 ms 512 KB Output is correct
4 Correct 11 ms 768 KB Output is correct
5 Correct 11 ms 2048 KB Output is correct
6 Correct 12 ms 2944 KB Output is correct
7 Correct 12 ms 3584 KB Output is correct
8 Correct 12 ms 384 KB Output is correct
9 Correct 13 ms 5932 KB Output is correct
10 Correct 13 ms 5760 KB Output is correct
11 Correct 15 ms 8320 KB Output is correct
12 Correct 23 ms 1152 KB Output is correct
13 Correct 40 ms 8820 KB Output is correct
14 Correct 52 ms 10736 KB Output is correct
15 Correct 72 ms 11632 KB Output is correct
16 Correct 89 ms 5220 KB Output is correct
17 Correct 92 ms 5356 KB Output is correct
18 Correct 94 ms 7532 KB Output is correct
19 Correct 104 ms 13544 KB Output is correct
20 Correct 101 ms 13416 KB Output is correct