Submission #850305

# Submission time Handle Problem Language Result Execution time Memory
850305 2023-09-16T10:02:39 Z Antonela FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
45 ms 9176 KB
#include "museum.h"
#include <bits/stdc++.h>

using namespace std;

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) 
{
	int N = B.size();
	long long result=0, one=1, two=2;
	int b[100]={}, t[100]={}, g[100]={}, bt[100][100]={}, tg[100][100]={}, bg[100][100]={}, btg[100][100][100]={};
	for(int i=0; i<N; i++)
    {
        b[B[i]-1]++;
        t[T[i]-1]++;
        g[G[i]-1]++;
        bg[B[i]-1][G[i]-1]++;
        bt[B[i]-1][T[i]-1]++;
        tg[T[i]-1][G[i]-1]++;
        btg[B[i]-1][T[i]-1][G[i]-1]++;
    }
    for(int i=0; i<100; i++)
    {
        result+=((b[i])*(b[i]-one))/two;
        result+=((t[i])*(t[i]-one))/two;
        result+=((g[i])*(g[i]-one))/two;
    }
    for(int i=0; i<100; i++)
    {
        for(int j=0; j<100; j++)
        {
            result-=((bt[i][j])*(bt[i][j]-one))/two;
            result-=((tg[i][j])*(tg[i][j]-one))/two;
            result-=((bg[i][j])*(bg[i][j]-one))/two;
        }
    }
	for(int i=0; i<100; i++)
    {
        for(int j=0; j<100; j++)
        {
            for(int k=0; k<100; k++)
                result+=((btg[i][j][k])*(btg[i][j][k]-one))/two;
        }
    }
	return result;
}
//int main(){}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4444 KB Output is correct
2 Correct 3 ms 4444 KB Output is correct
3 Correct 3 ms 4444 KB Output is correct
4 Correct 3 ms 4444 KB Output is correct
5 Correct 4 ms 4444 KB Output is correct
6 Correct 5 ms 4696 KB Output is correct
7 Correct 4 ms 4444 KB Output is correct
8 Correct 4 ms 4444 KB Output is correct
9 Correct 4 ms 4444 KB Output is correct
10 Correct 4 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4444 KB Output is correct
2 Correct 3 ms 4444 KB Output is correct
3 Correct 3 ms 4444 KB Output is correct
4 Correct 3 ms 4444 KB Output is correct
5 Correct 4 ms 4444 KB Output is correct
6 Correct 5 ms 4696 KB Output is correct
7 Correct 4 ms 4444 KB Output is correct
8 Correct 4 ms 4444 KB Output is correct
9 Correct 4 ms 4444 KB Output is correct
10 Correct 4 ms 4444 KB Output is correct
11 Correct 5 ms 4440 KB Output is correct
12 Correct 9 ms 5212 KB Output is correct
13 Correct 20 ms 5856 KB Output is correct
14 Correct 21 ms 6364 KB Output is correct
15 Correct 26 ms 7468 KB Output is correct
16 Correct 45 ms 9132 KB Output is correct
17 Correct 41 ms 9176 KB Output is correct
18 Correct 41 ms 9164 KB Output is correct
19 Correct 42 ms 9164 KB Output is correct
20 Correct 43 ms 9168 KB Output is correct