Submission #148600

# Submission time Handle Problem Language Result Execution time Memory
148600 2019-09-01T04:45:10 Z 준표야 함수컵은 캐리해줄거지?(#3588, Acka, spectaclehong, heiler) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
98 ms 9196 KB
#include "museum.h"
#include <algorithm>
using namespace std;

typedef long long ll;

int cnt[101][101][101];

long long nC2(ll n){
	return n * (n - 1) / 2;
}

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++)
		cnt[B[i]][T[i]][G[i]]++;

	ll ans = 0;
	for(int i = 1; i <= 100; i++){
		int s1 = 0, s2 = 0, s3 = 0;
		for(int j = 1; j <= 100; j++){
			int d12 = 0, d13 = 0, d23 = 0;
			for(int k = 1; k <= 100; k++){
				s1 += cnt[i][j][k];
				s2 += cnt[j][i][k];
				s3 += cnt[j][k][i];
				d12 += cnt[i][j][k];
				d13 += cnt[i][k][j];
				d23 += cnt[k][i][j];
				ans += nC2(cnt[i][j][k]);
			}
			ans -= nC2(d12); ans -= nC2(d13); ans -= nC2(d23);
		}
		ans += nC2(s1); ans += nC2(s2); ans += nC2(s3);
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 10 ms 512 KB Output is correct
4 Correct 10 ms 640 KB Output is correct
5 Correct 10 ms 1536 KB Output is correct
6 Correct 10 ms 2048 KB Output is correct
7 Correct 12 ms 2944 KB Output is correct
8 Correct 11 ms 512 KB Output is correct
9 Correct 14 ms 3788 KB Output is correct
10 Correct 16 ms 3840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 10 ms 512 KB Output is correct
4 Correct 10 ms 640 KB Output is correct
5 Correct 10 ms 1536 KB Output is correct
6 Correct 10 ms 2048 KB Output is correct
7 Correct 12 ms 2944 KB Output is correct
8 Correct 11 ms 512 KB Output is correct
9 Correct 14 ms 3788 KB Output is correct
10 Correct 16 ms 3840 KB Output is correct
11 Correct 19 ms 4480 KB Output is correct
12 Correct 20 ms 1280 KB Output is correct
13 Correct 36 ms 5364 KB Output is correct
14 Correct 50 ms 6380 KB Output is correct
15 Correct 71 ms 7408 KB Output is correct
16 Correct 81 ms 5224 KB Output is correct
17 Correct 80 ms 5348 KB Output is correct
18 Correct 85 ms 6376 KB Output is correct
19 Correct 98 ms 9192 KB Output is correct
20 Correct 95 ms 9196 KB Output is correct