Submission #148966

# Submission time Handle Problem Language Result Execution time Memory
148966 2019-09-01T05:28:41 Z Showing Hands(#3746, hamzqq9, yusufake) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
102 ms 9708 KB
#include "museum.h"
#include<bits/stdc++.h>
#define sz(x) ((int)x.size())
#define pb push_back
#define ii pair<int,int>
#define st first
#define nd second
#define ll long long
#define N 200005
#define inf 1000000000
#define MOD 1000000007
using namespace std;

int n;
int cnt1[3][105],cnt2[3][105][105],cnt3[105][105][105];

long long CountSimilarPairs(std::vector<int> B, std::vector<int> T, std::vector<int> G) {

	ll ans=0;

	n=sz(B);

	for(int i=0;i<n;i++) {

		cnt1[0][B[i]]++;
		cnt1[1][T[i]]++;
		cnt1[2][G[i]]++;

		cnt2[0][B[i]][T[i]]++;
		cnt2[1][B[i]][G[i]]++;
		cnt2[2][T[i]][G[i]]++;

		cnt3[B[i]][T[i]][G[i]]++;

	}

	for(int i=0;i<3;i++) {

		for(int j=1;j<=100;j++) {

			ans+=(ll)cnt1[i][j]*(cnt1[i][j]-1)/2;

		}

	}

	for(int i=0;i<3;i++) {

		for(int k=1;k<=100;k++) {

			for(int l=1;l<=100;l++) {

				ans-=(ll)cnt2[i][k][l]*(cnt2[i][k][l]-1)/2;

			}

		}

	}

	for(int i=1;i<=100;i++) {

		for(int j=1;j<=100;j++) {

			for(int k=1;k<=100;k++) {

				ans+=(ll)cnt3[i][j][k]*(cnt3[i][j][k]-1)/2;

			}

		}

	}

	return ans;

}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 8 ms 640 KB Output is correct
5 Correct 10 ms 1792 KB Output is correct
6 Correct 9 ms 2304 KB Output is correct
7 Correct 9 ms 3072 KB Output is correct
8 Correct 9 ms 512 KB Output is correct
9 Correct 10 ms 4224 KB Output is correct
10 Correct 10 ms 4096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 8 ms 640 KB Output is correct
5 Correct 10 ms 1792 KB Output is correct
6 Correct 9 ms 2304 KB Output is correct
7 Correct 9 ms 3072 KB Output is correct
8 Correct 9 ms 512 KB Output is correct
9 Correct 10 ms 4224 KB Output is correct
10 Correct 10 ms 4096 KB Output is correct
11 Correct 11 ms 4992 KB Output is correct
12 Correct 20 ms 1152 KB Output is correct
13 Correct 33 ms 5616 KB Output is correct
14 Correct 47 ms 6896 KB Output is correct
15 Correct 65 ms 7920 KB Output is correct
16 Correct 85 ms 5228 KB Output is correct
17 Correct 86 ms 5348 KB Output is correct
18 Correct 92 ms 6500 KB Output is correct
19 Correct 102 ms 9704 KB Output is correct
20 Correct 94 ms 9708 KB Output is correct