답안 #148370

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148370 2019-09-01T04:11:32 Z 강력한 한방 필살기(#3595, gs14004, kriii, OnionPringles) 함수컵 박물관 (FXCUP4_museum) C++17
100 / 100
92 ms 9196 KB
#include "museum.h"

#include <string.h>

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	static int a[100],b[100][100],c[100][100][100];
	int n = B.size();
	long long ans=0;
	for(int i=0;i<n;i++)B[i]--,T[i]--,G[i]--;
	
	memset(a,0,sizeof(a));
	for(int i=0;i<n;i++)a[B[i]]++;
	for(int i=0;i<100;i++)ans+=1LL*a[i]*(a[i]-1)/2;
	
	memset(a,0,sizeof(a));
	for(int i=0;i<n;i++)a[T[i]]++;
	for(int i=0;i<100;i++)ans+=1LL*a[i]*(a[i]-1)/2;
	
	memset(a,0,sizeof(a));
	for(int i=0;i<n;i++)a[G[i]]++;
	for(int i=0;i<100;i++)ans+=1LL*a[i]*(a[i]-1)/2;
	
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++)b[B[i]][T[i]]++;
	for(int i=0;i<100;i++)for(int j=0;j<100;j++)ans-=1LL*b[i][j]*(b[i][j]-1)/2;
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++)b[G[i]][T[i]]++;
	for(int i=0;i<100;i++)for(int j=0;j<100;j++)ans-=1LL*b[i][j]*(b[i][j]-1)/2;
	memset(b,0,sizeof(b));
	for(int i=0;i<n;i++)b[B[i]][G[i]]++;
	for(int i=0;i<100;i++)for(int j=0;j<100;j++)ans-=1LL*b[i][j]*(b[i][j]-1)/2;
	
	memset(c,0,sizeof(c));
	for(int i=0;i<n;i++)c[B[i]][T[i]][G[i]]++;
	for(int i=0;i<100;i++)for(int j=0;j<100;j++)for(int k=0;k<100;k++)ans+=1LL*c[i][j][k]*(c[i][j][k]-1)/2;

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 4352 KB Output is correct
2 Correct 10 ms 4352 KB Output is correct
3 Correct 9 ms 4352 KB Output is correct
4 Correct 9 ms 4352 KB Output is correct
5 Correct 10 ms 4352 KB Output is correct
6 Correct 9 ms 4352 KB Output is correct
7 Correct 9 ms 4352 KB Output is correct
8 Correct 10 ms 4352 KB Output is correct
9 Correct 10 ms 4352 KB Output is correct
10 Correct 10 ms 4352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 4352 KB Output is correct
2 Correct 10 ms 4352 KB Output is correct
3 Correct 9 ms 4352 KB Output is correct
4 Correct 9 ms 4352 KB Output is correct
5 Correct 10 ms 4352 KB Output is correct
6 Correct 9 ms 4352 KB Output is correct
7 Correct 9 ms 4352 KB Output is correct
8 Correct 10 ms 4352 KB Output is correct
9 Correct 10 ms 4352 KB Output is correct
10 Correct 10 ms 4352 KB Output is correct
11 Correct 11 ms 4480 KB Output is correct
12 Correct 21 ms 5120 KB Output is correct
13 Correct 32 ms 5756 KB Output is correct
14 Correct 44 ms 6384 KB Output is correct
15 Correct 61 ms 7316 KB Output is correct
16 Correct 82 ms 9192 KB Output is correct
17 Correct 84 ms 9192 KB Output is correct
18 Correct 87 ms 9196 KB Output is correct
19 Correct 92 ms 9192 KB Output is correct
20 Correct 90 ms 9060 KB Output is correct