답안 #150934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
150934 2019-09-01T12:19:54 Z nvmdava 함수컵 박물관 (FXCUP4_museum) C++17
100 / 100
81 ms 11328 KB
#include "museum.h"
 
int cnt[105][105][105];
long long res = 0;
long long get(long long s){
	return s * (s - 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++){
		int a = B[i];
		int b = T[i];
		int c = G[i];
		cnt[a][0][0]++;
		cnt[0][b][0]++;
		cnt[0][0][c]++;
		cnt[a][b][0]++;
		cnt[0][b][c]++;
		cnt[a][0][c]++;
		cnt[a][b][c]++;
	}
 
	for(int i = 0; i <= 100; i++){
		for(int j = 0; j <= 100; j++){
			for(int l = 0; l <= 100; l++){
				int t = 3;
				if(i == 0) t--;
				if(j == 0) t--;
				if(l == 0) t--;
				res += (t % 2 == 1 ? 1 : -1) * get(cnt[i][j][l]);
			}
		}
	}
 
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 656 KB Output is correct
5 Correct 6 ms 2040 KB Output is correct
6 Correct 6 ms 2424 KB Output is correct
7 Correct 7 ms 3192 KB Output is correct
8 Correct 6 ms 524 KB Output is correct
9 Correct 8 ms 4220 KB Output is correct
10 Correct 9 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 656 KB Output is correct
5 Correct 6 ms 2040 KB Output is correct
6 Correct 6 ms 2424 KB Output is correct
7 Correct 7 ms 3192 KB Output is correct
8 Correct 6 ms 524 KB Output is correct
9 Correct 8 ms 4220 KB Output is correct
10 Correct 9 ms 4216 KB Output is correct
11 Correct 9 ms 4856 KB Output is correct
12 Correct 15 ms 1272 KB Output is correct
13 Correct 26 ms 6004 KB Output is correct
14 Correct 37 ms 7072 KB Output is correct
15 Correct 51 ms 8788 KB Output is correct
16 Correct 67 ms 6316 KB Output is correct
17 Correct 70 ms 6508 KB Output is correct
18 Correct 74 ms 8032 KB Output is correct
19 Correct 81 ms 11328 KB Output is correct
20 Correct 79 ms 11268 KB Output is correct