Submission #148377

# Submission time Handle Problem Language Result Execution time Memory
148377 2019-09-01T04:12:50 Z 맞WATLE(#3593, arnold518, ksmzzang2003, songc) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
101 ms 14564 KB
#include <bits/stdc++.h>
#include "museum.h"
using namespace std;
typedef long long LL;

int N;
LL ans;
LL BC[110], TC[110], GC[110];
LL BT[110][110], TG[110][110], BG[110][110];
LL BTG[110][110][110];

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++) {
		BC[B[i]]++, TC[T[i]]++, GC[G[i]]++;
		BT[B[i]][T[i]]++;
		TG[T[i]][G[i]]++;
		BG[B[i]][G[i]]++;
		BTG[B[i]][T[i]][G[i]]++;
	}
	for (int i=1; i<=100; i++){
		ans += BC[i]*(BC[i]-1)/2;
		ans += TC[i]*(TC[i]-1)/2;
		ans += GC[i]*(GC[i]-1)/2;
	}
	for (int i=1; i<=100; i++){
		for (int j=1; j<=100; j++){
			ans -= BT[i][j]*(BT[i][j]-1)/2;
			ans -= TG[i][j]*(TG[i][j]-1)/2;
			ans -= BG[i][j]*(BG[i][j]-1)/2;
		}
	}
	for (int i=1; i<=100; i++) for (int j=1; j<=100; j++) for (int k=1; k<=100; k++) ans += BTG[i][j][k]*(BTG[i][j][k]-1)/2;
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 10 ms 384 KB Output is correct
3 Correct 9 ms 640 KB Output is correct
4 Correct 10 ms 768 KB Output is correct
5 Correct 9 ms 2048 KB Output is correct
6 Correct 10 ms 3072 KB Output is correct
7 Correct 11 ms 3712 KB Output is correct
8 Correct 10 ms 768 KB Output is correct
9 Correct 12 ms 5888 KB Output is correct
10 Correct 12 ms 6016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 10 ms 384 KB Output is correct
3 Correct 9 ms 640 KB Output is correct
4 Correct 10 ms 768 KB Output is correct
5 Correct 9 ms 2048 KB Output is correct
6 Correct 10 ms 3072 KB Output is correct
7 Correct 11 ms 3712 KB Output is correct
8 Correct 10 ms 768 KB Output is correct
9 Correct 12 ms 5888 KB Output is correct
10 Correct 12 ms 6016 KB Output is correct
11 Correct 15 ms 8960 KB Output is correct
12 Correct 19 ms 1152 KB Output is correct
13 Correct 35 ms 9332 KB Output is correct
14 Correct 46 ms 11632 KB Output is correct
15 Correct 67 ms 12656 KB Output is correct
16 Correct 85 ms 5224 KB Output is correct
17 Correct 85 ms 5352 KB Output is correct
18 Correct 90 ms 7656 KB Output is correct
19 Correct 101 ms 14564 KB Output is correct
20 Correct 99 ms 14444 KB Output is correct