Submission #148396

# Submission time Handle Problem Language Result Execution time Memory
148396 2019-09-01T04:17:13 Z 본인 방금 올솔하는 상상함(#3610, gs18113, dennisstar, red1108) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
102 ms 13288 KB
#include "museum.h"


long long cnt1[101],cnt2[101][101],cnt3[101][101][101];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	long long ret=0;
	for(auto i:B) cnt1[i]++;
	for(int i=1;i<=100;i++){
		ret = ret+cnt1[i]*(cnt1[i]-1)/2;
		cnt1[i]=0;
	}
	for(auto i:T) cnt1[i]++;
	for(int i=1;i<=100;i++){
		ret = ret+cnt1[i]*(cnt1[i]-1)/2;
		cnt1[i]=0;
	}
	for(auto i:G) cnt1[i]++;
	for(int i=1;i<=100;i++){
		ret = ret+cnt1[i]*(cnt1[i]-1)/2;
		cnt1[i]=0;
	}
	for(int i=0;i<N;i++) cnt2[B[i]][T[i]]++;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			ret = ret-cnt2[i][j]*(cnt2[i][j]-1)/2;
			cnt2[i][j]=0;
		}
	}
	for(int i=0;i<N;i++) cnt2[B[i]][G[i]]++;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			ret = ret-cnt2[i][j]*(cnt2[i][j]-1)/2;
			cnt2[i][j]=0;
		}
	}
	for(int i=0;i<N;i++) cnt2[T[i]][G[i]]++;
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			ret = ret-cnt2[i][j]*(cnt2[i][j]-1)/2;
			cnt2[i][j]=0;
		}
	}
	for(int i=0;i<N;i++){
		cnt3[B[i]][T[i]][G[i]]++;
	}
	for(int i=1;i<=100;i++){
		for(int j=1;j<=100;j++){
			for(int k=1;k<=100;k++){
				ret = ret+cnt3[i][j][k]*(cnt3[i][j][k]-1)/2;
			}
		}
	}
	return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 512 KB Output is correct
2 Correct 8 ms 524 KB Output is correct
3 Correct 9 ms 512 KB Output is correct
4 Correct 8 ms 768 KB Output is correct
5 Correct 10 ms 1792 KB Output is correct
6 Correct 9 ms 2816 KB Output is correct
7 Correct 10 ms 3328 KB Output is correct
8 Correct 10 ms 640 KB Output is correct
9 Correct 11 ms 5504 KB Output is correct
10 Correct 11 ms 5504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 512 KB Output is correct
2 Correct 8 ms 524 KB Output is correct
3 Correct 9 ms 512 KB Output is correct
4 Correct 8 ms 768 KB Output is correct
5 Correct 10 ms 1792 KB Output is correct
6 Correct 9 ms 2816 KB Output is correct
7 Correct 10 ms 3328 KB Output is correct
8 Correct 10 ms 640 KB Output is correct
9 Correct 11 ms 5504 KB Output is correct
10 Correct 11 ms 5504 KB Output is correct
11 Correct 13 ms 8064 KB Output is correct
12 Correct 21 ms 1280 KB Output is correct
13 Correct 36 ms 8692 KB Output is correct
14 Correct 48 ms 10480 KB Output is correct
15 Correct 69 ms 11504 KB Output is correct
16 Correct 81 ms 5348 KB Output is correct
17 Correct 89 ms 5480 KB Output is correct
18 Correct 93 ms 7400 KB Output is correct
19 Correct 98 ms 13280 KB Output is correct
20 Correct 102 ms 13288 KB Output is correct