Submission #148374

# Submission time Handle Problem Language Result Execution time Memory
148374 2019-09-01T04:12:08 Z Dopatii(#3751, bogdan10bos, Gioto, Bodo171) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
103 ms 9580 KB
#include "museum.h"

int ap[105][105][105];
int i;
long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {
	int N = B.size();
	long long ans=0;
	for(i=0;i<N;i++)
    {
        long long coef=(ap[B[i]][0][0]+ap[0][T[i]][0]+ap[0][0][G[i]]-ap[B[i]][T[i]][0]-ap[B[i]][0][G[i]]-ap[0][T[i]][G[i]]+ap[B[i]][T[i]][G[i]]);
        ans+=(coef);
        ap[B[i]][0][0]++;
        ap[0][T[i]][0]++;
        ap[0][0][G[i]]++;
        ap[B[i]][T[i]][0]++;
        ap[B[i]][0][G[i]]++;
        ap[0][T[i]][G[i]]++;
        ap[B[i]][T[i]][G[i]]++;
    }
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 428 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 5 ms 720 KB Output is correct
5 Correct 6 ms 2048 KB Output is correct
6 Correct 7 ms 2432 KB Output is correct
7 Correct 8 ms 3328 KB Output is correct
8 Correct 6 ms 256 KB Output is correct
9 Correct 9 ms 4224 KB Output is correct
10 Correct 9 ms 4224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 428 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 5 ms 720 KB Output is correct
5 Correct 6 ms 2048 KB Output is correct
6 Correct 7 ms 2432 KB Output is correct
7 Correct 8 ms 3328 KB Output is correct
8 Correct 6 ms 256 KB Output is correct
9 Correct 9 ms 4224 KB Output is correct
10 Correct 9 ms 4224 KB Output is correct
11 Correct 10 ms 4864 KB Output is correct
12 Correct 17 ms 1112 KB Output is correct
13 Correct 33 ms 5492 KB Output is correct
14 Correct 46 ms 6768 KB Output is correct
15 Correct 65 ms 7664 KB Output is correct
16 Correct 81 ms 5204 KB Output is correct
17 Correct 83 ms 5356 KB Output is correct
18 Correct 90 ms 6500 KB Output is correct
19 Correct 102 ms 9448 KB Output is correct
20 Correct 103 ms 9580 KB Output is correct