Submission #111209

# Submission time Handle Problem Language Result Execution time Memory
111209 2019-05-14T07:26:15 Z imsifile FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
130 ms 10088 KB
#include "museum.h"
using namespace std;

int Bs[111], Ts[111], Gs[111], BT[111][111], TG[111][111], BG[111][111], BTG[111][111][111];
long long sum;

long long CountSimilarPairs(int N, vector<int> B, vector<int> T, vector<int> G) {
	for(int i=0; i<N; i++){
		sum += Bs[B[i]]+Ts[T[i]]+Gs[G[i]];
		Bs[B[i]]++, Ts[T[i]]++, Gs[G[i]]++;
		sum -= BT[B[i]][T[i]]+TG[T[i]][G[i]]+BG[B[i]][G[i]];
		BT[B[i]][T[i]]++, TG[T[i]][G[i]]++, BG[B[i]][G[i]]++;
		sum += BTG[B[i]][T[i]][G[i]];
		BTG[B[i]][T[i]][G[i]]++;
	}
	return sum;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 4 ms 1712 KB Output is correct
6 Correct 4 ms 2304 KB Output is correct
7 Correct 4 ms 3072 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 6 ms 4352 KB Output is correct
10 Correct 6 ms 4224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 640 KB Output is correct
5 Correct 4 ms 1712 KB Output is correct
6 Correct 4 ms 2304 KB Output is correct
7 Correct 4 ms 3072 KB Output is correct
8 Correct 3 ms 512 KB Output is correct
9 Correct 6 ms 4352 KB Output is correct
10 Correct 6 ms 4224 KB Output is correct
11 Correct 8 ms 5120 KB Output is correct
12 Correct 10 ms 1100 KB Output is correct
13 Correct 23 ms 5748 KB Output is correct
14 Correct 36 ms 7280 KB Output is correct
15 Correct 86 ms 8428 KB Output is correct
16 Correct 79 ms 5100 KB Output is correct
17 Correct 65 ms 5224 KB Output is correct
18 Correct 130 ms 6500 KB Output is correct
19 Correct 96 ms 10088 KB Output is correct
20 Correct 108 ms 10088 KB Output is correct