Submission #149114

# Submission time Handle Problem Language Result Execution time Memory
149114 2019-09-01T05:46:01 Z distutpia(#3780, cblimmm, wooks1998) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
113 ms 13288 KB
#include "museum.h"
long long int numB[100];
long long int numT[100];
long long int numG[100];
long long int numBT[10000];
long long int numBG[10000];
long long int numTG[10000];
long long int numBTG[1000000];
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	for(int i=0; i<N; i++){
		B[i]--;
		T[i]--;
		G[i]--;
		numB[B[i]]++;
		numT[T[i]]++;
		numG[G[i]]++;
		numBT[100*B[i]+T[i]]++;
		numBG[100*B[i]+G[i]]++;
		numTG[100*T[i]+G[i]]++;
		numBTG[10000*B[i]+100*T[i]+G[i]]++;
	}
	long long int ans=0;
	for(int i=0; i<100; i++){
		ans+=numB[i]*(numB[i]-1)/2;
		ans+=numT[i]*(numT[i]-1)/2;
		ans+=numG[i]*(numG[i]-1)/2;
	}
	for(int i=0; i<10000; i++){
		ans-=numBT[i]*(numBT[i]-1)/2;
		ans-=numBG[i]*(numBG[i]-1)/2;
		ans-=numTG[i]*(numTG[i]-1)/2;
	}
	for(int i=0; i<1000000; i++){
		ans+=(numBTG[i])*(numBTG[i]-1)/2;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 8 ms 512 KB Output is correct
3 Correct 9 ms 512 KB Output is correct
4 Correct 9 ms 768 KB Output is correct
5 Correct 8 ms 2048 KB Output is correct
6 Correct 10 ms 2816 KB Output is correct
7 Correct 9 ms 3712 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 10 ms 5760 KB Output is correct
10 Correct 11 ms 5760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 8 ms 512 KB Output is correct
3 Correct 9 ms 512 KB Output is correct
4 Correct 9 ms 768 KB Output is correct
5 Correct 8 ms 2048 KB Output is correct
6 Correct 10 ms 2816 KB Output is correct
7 Correct 9 ms 3712 KB Output is correct
8 Correct 8 ms 640 KB Output is correct
9 Correct 10 ms 5760 KB Output is correct
10 Correct 11 ms 5760 KB Output is correct
11 Correct 14 ms 8192 KB Output is correct
12 Correct 18 ms 1152 KB Output is correct
13 Correct 37 ms 8692 KB Output is correct
14 Correct 54 ms 10480 KB Output is correct
15 Correct 69 ms 11496 KB Output is correct
16 Correct 79 ms 5224 KB Output is correct
17 Correct 80 ms 5356 KB Output is correct
18 Correct 95 ms 7528 KB Output is correct
19 Correct 107 ms 13288 KB Output is correct
20 Correct 113 ms 13288 KB Output is correct