Submission #150106

# Submission time Handle Problem Language Result Execution time Memory
150106 2019-09-01T07:43:32 Z 강한친구 대한육군(#3592, pichulia) FunctionCup Museum (FXCUP4_museum) C++17
100 / 100
95 ms 9452 KB
#include "museum.h"
#include<vector>
#include<algorithm>
using namespace std;
int a[102];
int b[102];
int c[102];
int ab[102][102];
int bc[102][102];
int ca[102][102];
int abc[102][102][102];
long long cal(int x) {
	long long int res = x;
	return res * (res - 1) / 2;
}
long long CountSimilarPairs(std::vector<int> x, std::vector<int> y, std::vector<int> z) {
	int n = x.size();
	long long int res = 0;
	int i, j, k;
	for (i = 0; i < n; i++)
	{
		a[x[i]]++;
		b[y[i]]++;
		c[z[i]]++;
		ab[x[i]][y[i]]++;
		bc[y[i]][z[i]]++;
		ca[z[i]][x[i]]++;
		abc[x[i]][y[i]][z[i]]++;
	}
	for (i = 1; i <= 100; i++)
	{
		res += cal(a[i]);
		res += cal(b[i]);
		res += cal(c[i]);
		for (j = 1; j <= 100; j++) {
			res -= cal(ab[i][j]);
			res -= cal(bc[i][j]);
			res -= cal(ca[i][j]);
			for (k = 1; k <= 100; k++) {
				res += cal(abc[i][j][k]);
			}
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 7 ms 640 KB Output is correct
5 Correct 8 ms 1792 KB Output is correct
6 Correct 9 ms 2304 KB Output is correct
7 Correct 9 ms 2944 KB Output is correct
8 Correct 8 ms 512 KB Output is correct
9 Correct 9 ms 4096 KB Output is correct
10 Correct 9 ms 4096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 7 ms 640 KB Output is correct
5 Correct 8 ms 1792 KB Output is correct
6 Correct 9 ms 2304 KB Output is correct
7 Correct 9 ms 2944 KB Output is correct
8 Correct 8 ms 512 KB Output is correct
9 Correct 9 ms 4096 KB Output is correct
10 Correct 9 ms 4096 KB Output is correct
11 Correct 11 ms 4736 KB Output is correct
12 Correct 18 ms 1152 KB Output is correct
13 Correct 33 ms 5364 KB Output is correct
14 Correct 42 ms 6636 KB Output is correct
15 Correct 64 ms 7584 KB Output is correct
16 Correct 79 ms 5224 KB Output is correct
17 Correct 87 ms 5316 KB Output is correct
18 Correct 91 ms 6504 KB Output is correct
19 Correct 95 ms 9444 KB Output is correct
20 Correct 93 ms 9452 KB Output is correct